Библиотека сайта rus-linux.net
14. Network routing issues (using PPP as a \cheap\ bridge)
14.1 Slattach and ifconfig don't work as they do with SLIP
Do not use slattach and ifconfig with PPP. These are used for SLIP. The pppd process does these functions at the appropriate time. These must occur after the LCP and IPCP protocols have been exchanged.
You can not replace pppd with slattach and ifconfig. Most of the protocol support for PPP is in the pppd process. Only the IP and IPX processing is in the kernel.
The host route to the remote system will be automatically added by pppd. There is no option to NOT add the route. The pppd process will terminate if the route could not be added.
The default route may or may not be added. This is controlled by the option \defaultroute\. If you have a default route, it will not be changed.
If you must do routing for an entire network, then put the route command into the /etc/ppp/ip-up script. The parameters to the script are:
$0 - name of the script (/etc/ppp/ip-up or /etc/ppp/ip-down)
$1 - name of the network device (such as ppp0)
$2 - name of the tty device (such as /dev/cua0)
$3 - speed of the tty device in Bits Per Second (such as 38400)
$4 - the local IP address in dotted decimal notation
$5 - the remote IP address in dotted decimal notation
$6 - the value of the ipparam parameter
14.2 I want the route to the network and not the route to the host.
On sunsite there is a package called devinfo.tar.gz. It contains some useful little programs which will extract the data from the device and to do various things with the dotted IP addresses.
The documentation is in the man pages in the file.
For example, if you want to route the entire IP domain to the remote, the following may be used in /etc/ppp/ip-up.
Of course, if the values are not variable, then simply use the appropriate entry in the route command.
# Obtain the netmask for the ppp0 (or whatever) device
NETMASK = `devinfo -d $1 -t mask`
# Obtain the IP domain (without the host address by removing the extra bits)
DOMAIN = `netmath -a $5 $NETMASK`
# Do the network route now that the IP domain is known
route -net add $DOMAIN gw $5
Previous Next Table of Contents