[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lugbe] request-route



Hallo Marco

Marco Balmer wrote:
> 
> Hallo
> 
> Wie müsste ich das script den schreiben, sorry ich bin kein script profi.
> wiso gibt es request-route nicht in den neueren Kernel versionen?
> Und wiso ist dies nirgends im Handbuch beschrieben?

Also, warum das im neuen Kernel nicht mehr supported ist, weiss
ich nicht, habe das nur mehrmals gelesen. 

Hier ein Beispiel, wie man das Einwaehlen abhaengig von der 
ausloesenden IP-Adresse unterbinden koennte:

#! /bin/sh
#-------------------------------------------------------------------------------
# /sbin/request-route
#
# Author:
#   Didi Niklaus <didi.niklaus at gmx.ch>
#
# Reference:
#  
ftp://metalab.unc.edu/pub/Linux/docs/HOWTO/unmaintained/mini/Dial-On-Demand
#
# Description:
#   A feature of the kerneld, described in the kerneld-HOWTO, is the
ability
#   to invoke a script, if a particular route is missing. Kerneld will
look
#   for '/sbin/request-route' to execute, which brings up a PPP
connection.
#   This script will be called from kerneld with the requested route as
$1.
#
# Note:
#   No longer supported with kernel version 2.2.x (running under 2.0.35)
#-------------------------------------------------------------------------------

LOCK=/var/run/request-route.pid # lockfile
lock_time=60                    # set lock timeout value [s], tunable!
                                # (check kerneld delay as well)

LOG=/var/log/request-route      # log file

#-------------------------------------------------------------------------------
# set IP adress wich shall be rejected
#-------------------------------------------------------------------------------
reject="210.1.40.23"

#-------------------------------------------------------------------------------
# select a ISP (comment the others out)
#-------------------------------------------------------------------------------
ISP="datacomm"
#ISP="sunrise"

# check if we're already running:
if [ ! -f $LOCK ] ; then

    #--------------------------------
    if [$1 = $reject] ; then
        echo "" >> $LOG
        echo $1 is rejected >> $LOG
        echo "" >> $LOG
        exit 1
    fi
    #--------------------------------

    # Invoke PPP link to ISP
    /etc/ppp/ppp-up $ISP
    echo "" >> $LOG
    echo pppd started by $0 at `date` >> $LOG
    echo $0 invoked with IP address $1 >> $LOG

    # timer to be killed by ip-up
    sleep $lock_time &
    sleepid=$!
    echo $sleepid > $LOCK
    echo "timer started with PID $sleepid - waiting to be killed" >>
$LOG
    wait $sleepid
    echo "timer PID $sleepid terminated at `date`" >> $LOG
    echo "" >> $LOG
    rm -f $LOCK
    exit 0
fi

exit 1

#-------------------------------------------------------------------------------


Deine urspruengliche Frage nochmal:
> >> Das Request-route funktioniert, nun habe ich eine Frage:
> >> Ist es mögliche request-route einzuschränken, dass es nicht bei jeder DNS
> >> Anfrage die vom DNS Server selbst kommt eine Verbindung aufbaut???

Ob die Anfrage vom DNS selbst kommt (meinst Du Deinen lokalen 
DNS?) kann aber mit diesem Mechanismus nicht ausfindig gemacht 
werden. Mit obiger Scriptvariante wuerden saemtliche DNS-Anfragen
zum Provider-DNS (falls dieser die IP-Nummer 210.1.40.23 haette) 
abgewiesen, ist also nicht ganz das, was Du moechtest :< 

Gruss, Didi
-- 
                            (o o)
-------------------------ooO-(_)-Ooo-------------------------