dial-on-demand for diald
Does anyone have the rc.startup scripts and configurations for using the diald in dod mode?
William Perry Dulyea wrote:
Does anyone have the rc.startup scripts and configurations for using the diald in dod mode?
Ummmm I dont have info for diald but you can use wvdial in dod mode very easily hth rob ################################################ # this is an example /etc/wvdial.conf file # this is an example you should run wvdial to generate the config file for you # that will detect your modem # be sure to add in the New PPPD = 1 line # along with others that may be missing [Dialer Defaults] Modem = /dev/modem Baud = 57600 Init1 = ATZ Init2 = AT M0 L0 Q0 V1 E1 S0=0 &C1 &D2 S11=55 +FCLASS=0 Area Code = Phone = ispPhonenum Username = yourUsername Password = yourPassword Dial Command = ATDT Stupid Mode = 1 New PPPD = 1 ################################################# # this is the *working* German version place in /sbin/init.d/wvdial.dod # chmod this file to 744 #german version function log() { # logs the messages to system log HEAD=$0[$$] echo $MESSAGE logger -t $HEAD "$MESSAGE" } function setpppdparam() { # time to sleep for pppd to come up WAITFORPPPD=2 CONFFILE="/etc/wvdial.conf" TMPFILE="/tmp/wvdial.dod.tmp" # extract subsection cat /etc/wvdial.conf | sed -n "/Dialer.*$SECTION/{:x;p;n;/Dialer/q;bx}" > $TMPFILE VALUE=`cat $TMPFILE | grep "Modem" | cut -f2 -d"="` if [ ! -z "$VALUE" ]; then Modem=$VALUE; fi VALUE=`cat $TMPFILE | grep "Baud" | cut -f2 -d"="` if [ ! -z "$VALUE" ]; then Baud=$VALUE; fi VALUE=`cat $TMPFILE | grep "Username" | cut -f2 -d"="` if [ ! -z "$VALUE" ]; then Username=$VALUE; fi VALUE=`cat $TMPFILE | grep "Remote IP" | cut -f2 -d"="` if [ ! -z "$VALUE" ]; then Remote_IP=$VALUE; fi VALUE=`cat $TMPFILE | grep "Local IP" | cut -f2 -d"="` if [ ! -z "$VALUE" ]; then Local_IP=$VALUE; fi VALUE=`cat $TMPFILE | grep "Idle" | cut -f2 -d"="` if [ ! -z "$VALUE" ]; then Idle=$VALUE; fi VALUE=`cat $TMPFILE | grep "Defaultroute" | cut -f2 -d"="` if [ X$VALUE = XNo -o X$VALUE = XNO -o X$VALUE = Xno ]; \ then DEFAULTROUTE="nodefaultroute"; fi rm -f $TMPFILE } function killpppd() { if [ -e $PIDFILE ]; then MESSAGE="killing pppd process " PID=`cat $PIDFILE` MESSAGE=$MESSAGE"PID=$PID" log kill -15 $PID 2>/dev/null #kill -9 $PID 2>/dev/null rm $PIDFILE fi } function startpppd() { # set defaults, no defaults for # Username, Modem, Baud Local_IP="192.68.1.7" Remote_IP="198.68.1.4" Idle=300 DEFAULTROUTE="defaultroute" # get params from section "Dialer Default" SECTION=Defaults setpppdparam # parse given section ([Dailer xxx]) parameters while [ ! -z $1 ]; do SECTION=$1 setpppdparam shift done # start pppd in demand mode PPPPDPARAMS="$Local_IP:$Remote_IP $Modem $Baud modem crtscts $DEFAULTROUTE -detach user $Username ipcp-accept-local ipcp-accept-remote call wvdial demand idle $Idle" MESSAGE="starting pppd $PPPPDPARAMS connect \"/usr/bin/wvdial --chat $WVPARAMS\"... " pppd $PPPPDPARAMS connect "/usr/bin/wvdial --chat $WVPARAMS" &>/dev/null & PPPDPID=$! echo $PPPDPID > $PIDFILE MESSAGE=$MESSAGE"PID=$PPPDPID" log # setting dynamic - parameter for ppp - device # waiting pppd to come up sleep $WAITFORPPPD ls /var/run/ppp?.pid | while read PIDFILE ; do if [ X$PPPDPID = X`cat $PIDFILE` ]; then DEVICE=`echo $PIDFILE | cut -c 10-13` MESSAGE="setting $DEVICE dynamic " ifconfig $DEVICE dynamic ifconfig $DEVICE | grep "DYNAMIC" -q RES=$? if [ $RES -gt 0 ]; then MESSAGE=$MESSAGE"failed" exit 1 fi MESSAGE=$MESSAGE"done" log fi done exit 0 } # main LINKNAME=dod PIDFILE=/var/run/pppd.$LINKNAME.pid ACTION=$1 shift WVPARAMS=$@ case "$ACTION" in start) # make sure to start even when uncleanly stopped killpppd netstat --inet -p startpppd $@ netstat --inet -p ;; stop) # handle stop killpppd exit 0 ;; reload|restart) killpppd startpppd $@ ;; hangup) if [ -e $PIDFILE ]; then MESSAGE="hangup pppd connection " PID=`cat $PIDFILE` MESSAGE=$MESSAGE"PID=$PID" log kill -SIGHUP $PID #2>/dev/null exit 0 fi MESSAGE="no pppd connection" log exit 1 ;; # status) # ;; *) echo "Usage: /sbin/init.d/wvdial.dod {start [section [section [..]]]|hangup|stop|restart}" exit 1 ;; esac ################################################### # lastly linking the dod into the startup # link.sh chmod 744 and run ln -s /sbin/init.d/wvdial.dod /sbin/init.d/rc2.d/S20wvdial.dod sleep 1 ln -s /sbin/init.d/wvdial.dod /sbin/init.d/rc3.d/S20wvdial.dod sleep 1 ln -s /sbin/init.d/wvdial.dod /sbin/init.d/rc2.d/K20wvdial.dod sleep 1 ln -s /sbin/init.d/wvdial.dod /sbin/init.d/rc3.d/K20wvdial.dod
Thanks for the reply dizzy73, however I am not able to use wvdial on my U60. So I am looking at the alternatives. -William At 06:57 PM 3/19/01 -0500, dizzy73 wrote:
William Perry Dulyea wrote:
Does anyone have the rc.startup scripts and configurations for using the diald in dod mode?
Ummmm I dont have info for diald but you can use wvdial in dod mode very easily
hth
rob ################################################ # this is an example /etc/wvdial.conf file # this is an example you should run wvdial to generate the config file for you # that will detect your modem # be sure to add in the New PPPD = 1 line # along with others that may be missing
[Dialer Defaults] Modem = /dev/modem Baud = 57600 Init1 = ATZ Init2 = AT M0 L0 Q0 V1 E1 S0=0 &C1 &D2 S11=55 +FCLASS=0 Area Code = Phone = ispPhonenum Username = yourUsername Password = yourPassword Dial Command = ATDT Stupid Mode = 1 New PPPD = 1
################################################# # this is the *working* German version place in /sbin/init.d/wvdial.dod # chmod this file to 744
#german version function log() { # logs the messages to system log HEAD=$0[$$] echo $MESSAGE logger -t $HEAD "$MESSAGE" }
function setpppdparam() { # time to sleep for pppd to come up WAITFORPPPD=2 CONFFILE="/etc/wvdial.conf" TMPFILE="/tmp/wvdial.dod.tmp" # extract subsection cat /etc/wvdial.conf | sed -n "/Dialer.*$SECTION/{:x;p;n;/Dialer/q;bx}" > $TMPFILE VALUE=`cat $TMPFILE | grep "Modem" | cut -f2 -d"="` if [ ! -z "$VALUE" ]; then Modem=$VALUE; fi VALUE=`cat $TMPFILE | grep "Baud" | cut -f2 -d"="` if [ ! -z "$VALUE" ]; then Baud=$VALUE; fi VALUE=`cat $TMPFILE | grep "Username" | cut -f2 -d"="` if [ ! -z "$VALUE" ]; then Username=$VALUE; fi VALUE=`cat $TMPFILE | grep "Remote IP" | cut -f2 -d"="` if [ ! -z "$VALUE" ]; then Remote_IP=$VALUE; fi VALUE=`cat $TMPFILE | grep "Local IP" | cut -f2 -d"="` if [ ! -z "$VALUE" ]; then Local_IP=$VALUE; fi VALUE=`cat $TMPFILE | grep "Idle" | cut -f2 -d"="` if [ ! -z "$VALUE" ]; then Idle=$VALUE; fi VALUE=`cat $TMPFILE | grep "Defaultroute" | cut -f2 -d"="` if [ X$VALUE = XNo -o X$VALUE = XNO -o X$VALUE = Xno ]; \ then DEFAULTROUTE="nodefaultroute"; fi rm -f $TMPFILE }
function killpppd() { if [ -e $PIDFILE ]; then MESSAGE="killing pppd process " PID=`cat $PIDFILE` MESSAGE=$MESSAGE"PID=$PID" log kill -15 $PID 2>/dev/null #kill -9 $PID 2>/dev/null rm $PIDFILE fi }
function startpppd() { # set defaults, no defaults for # Username, Modem, Baud Local_IP="192.68.1.7" Remote_IP="198.68.1.4" Idle=300 DEFAULTROUTE="defaultroute"
# get params from section "Dialer Default" SECTION=Defaults setpppdparam
# parse given section ([Dailer xxx]) parameters while [ ! -z $1 ]; do SECTION=$1 setpppdparam shift done
# start pppd in demand mode PPPPDPARAMS="$Local_IP:$Remote_IP $Modem $Baud modem crtscts $DEFAULTROUTE -detach user $Username ipcp-accept-local ipcp-accept-remote call wvdial demand idle $Idle" MESSAGE="starting pppd $PPPPDPARAMS connect \"/usr/bin/wvdial --chat $WVPARAMS\"... " pppd $PPPPDPARAMS connect "/usr/bin/wvdial --chat $WVPARAMS" &>/dev/null & PPPDPID=$! echo $PPPDPID > $PIDFILE MESSAGE=$MESSAGE"PID=$PPPDPID" log # setting dynamic - parameter for ppp - device
# waiting pppd to come up sleep $WAITFORPPPD ls /var/run/ppp?.pid | while read PIDFILE ; do if [ X$PPPDPID = X`cat $PIDFILE` ]; then DEVICE=`echo $PIDFILE | cut -c 10-13` MESSAGE="setting $DEVICE dynamic " ifconfig $DEVICE dynamic ifconfig $DEVICE | grep "DYNAMIC" -q RES=$? if [ $RES -gt 0 ]; then MESSAGE=$MESSAGE"failed" exit 1 fi MESSAGE=$MESSAGE"done" log fi done exit 0 }
# main LINKNAME=dod PIDFILE=/var/run/pppd.$LINKNAME.pid ACTION=$1 shift WVPARAMS=$@
case "$ACTION" in start) # make sure to start even when uncleanly stopped killpppd netstat --inet -p startpppd $@ netstat --inet -p ;; stop) # handle stop killpppd exit 0 ;; reload|restart) killpppd startpppd $@ ;; hangup) if [ -e $PIDFILE ]; then MESSAGE="hangup pppd connection " PID=`cat $PIDFILE` MESSAGE=$MESSAGE"PID=$PID" log kill -SIGHUP $PID #2>/dev/null exit 0 fi MESSAGE="no pppd connection" log exit 1 ;; # status) # ;; *) echo "Usage: /sbin/init.d/wvdial.dod {start [section [section [..]]]|hangup|stop|restart}" exit 1 ;; esac
################################################### # lastly linking the dod into the startup # link.sh chmod 744 and run
ln -s /sbin/init.d/wvdial.dod /sbin/init.d/rc2.d/S20wvdial.dod sleep 1 ln -s /sbin/init.d/wvdial.dod /sbin/init.d/rc3.d/S20wvdial.dod sleep 1 ln -s /sbin/init.d/wvdial.dod /sbin/init.d/rc2.d/K20wvdial.dod sleep 1 ln -s /sbin/init.d/wvdial.dod /sbin/init.d/rc3.d/K20wvdial.dod
William Perry Dulyea wrote:
Thanks for the reply dizzy73, however I am not able to use wvdial on my U60. So I am looking at the alternatives.
-William
Whats a U60? Your running SuSE rite?? wvdial is a package that can be installed and I would think the source is included, so in the worst case you should be able to get the source from the cd (or website) then do a ./configure and make.... unless of course a U60 is ..... *incompatible*???? IIRC wvdail is ported to all the *nixes Ive used dialed a while back... Im sure if you check the archives you can find some info although wvdial and dod is *SO* much easier good luck rob
On Monday 19 March 2001 18:19, William Perry Dulyea wrote:
Does anyone have the rc.startup scripts and configurations for using the diald in dod mode?
Yes, But be patient, I have it at home so I forward this message there as a reminder. BB, Arjen
participants (3)
-
Arjen Runsink
-
dizzy73
-
William Perry Dulyea