|Linux PPP HOWTO|
|Prev||Chapter 25. After the link comes up - the /etc/ppp/ip-up script||Next|
The example below provides a variety of example uses.
#!/bin/bash # # Script which handles the routing issues as necessary for pppd # Only the link to Newman requires this handling. # # When the ppp link comes up, this script is called with the following # parameters # $1 the interface name used by pppd (e.g. ppp3) # $2 the tty device name # $3 the tty device speed # $4 the local IP address for the interface # $5 the remote IP address # $6 the parameter specified by the 'ipparam' option to pppd # case "$5" in # Handle the routing to the Newman Campus server 188.8.131.52) /sbin/route add -net 184.108.40.206 gw 220.127.116.11 # and flush the mail queue to get their email there asap! /usr/sbin/sendmail -q & ;; 18.104.22.168) # Our Internet link # When the link comes up, start the time server and synchronise to the world # provided it is not already running if [ ! -f /var/lock/subsys/xntpd ]; then /etc/rc.d/init.d/xntpd.init start & fi # Start the news server (if not already running) if [ ! -f /var/lock/subsys/news ]; then /etc/rc.d/init.d/news start & fi ;; 22.214.171.124) # Get the email down to my home machine as soon as the link comes up # No routing is required as my home Ethernet is handled by IP # masquerade and proxyarp routing. /usr/sbin/sendmail -q & ;; *) esac exit 0
As a result of bringing up the ppp link to our Newman campus and this script, we end up with the following routing table entries (this machine also is our general dial up PPP server AND handles our Internet link). I have interspersed comments in the output to help explain what each entry is) :-
[root@kepler /root]# route -n Kernel routing table Destination Gateway Genmask Flags MSS Window Use Iface # the HOST route to our remote internet gateway 126.96.36.199 * 255.255.255.255 UH 1500 0 134 ppp4 # the HOST route to our Newman campus server 188.8.131.52 * 255.255.255.255 UH 1500 0 82 ppp5 # the HOST route to my home ethernet 184.108.40.206 * 255.255.255.255 UH 1500 0 74 ppp3 # two of our general dial up PPP lines 220.127.116.11 * 255.255.255.255 UH 552 0 0 ppp2 18.104.22.168 * 255.255.255.255 UH 552 0 1 ppp1 # the specific network route to the Newman campus LAN 22.214.171.124 126.96.36.199 255.255.255.0 UG 1500 0 0 ppp5 # the route to our local Ethernet (super-netting two adjacent C classes) 188.8.131.52 * 255.255.254.0 U 1500 0 1683 eth0 # the route to the loop back device 127.0.0.0 * 255.0.0.0 U 3584 0 483 lo # the default route to the Internet default 184.108.40.206 * UG 1500 0 3633 ppp4