contents
Next: Link Control Options Up: IP Configuration Options Previous: Choosing IP Addresses

Routing Through a PPP Link

After setting up the network interface, pppd will usually set up a host route to its peer only. If the remote host is on a LAN, you certainly want to be able to connect to hosts ``behind'' your peer as well; that is, a network route must be set up.

We have already seen above that pppd can be asked to set the default route using the defaultroute option. This option is very useful if the PPP server you dialed up will act as your Internet gateway.

The reverse case, where your system acts as a gateway for a single host, is also relatively easy to accomplish. For example, take some employee at the Virtual Brewery whose home machine is called loner. When connecting to vlager through PPP, he uses an address on the Brewery's subnet. At vlager, we can now give pppd the proxyarp option, which will install a proxy ARP entry for loner. This will automatically make loner accessible from all hosts at the Brewery and the Winery.

However, things aren't always as easy as that, for instance when linking two local area networks. This usually requires adding a specific network route, because these networks may have their own default routes. Besides, having both peers use the PPP link as the default route would generate a loop, where packets to unknown destinations would ping-pong between the peers until their time-to-live expired.

As an example, suppose the Virtual Brewery opens a branch in some other city. The subsidiary runs an Ethernet of their own using the IP network number 191.72.3.0, which is subnet 3 of the Brewery's class B network. They want to connect to the Brewery's main Ethernet via PPP to update customer databases, etc. Again, vlager acts as the gateway; its peer is called sub-etha and has an IP-address of 191.72.3.1..

When sub-etha connects to vlager, it will make the default route point to vlager as usual. On vlager, however, we will have to install a network route for subnet-3 that goes through sub-etha. For this, we use a feature of pppd not discussed so far-- the ip-up command. This is a shell script or program located in /etc/ppp that is executed after the PPP interface has been configured. When present, it is invoked with the following parameters:

           ip-up iface device speed local addr remote addr

where iface names the network interface used, device is the pathname of the serial device file used (/dev/tty if stdin/stdout are used), and speed is the device's speed. local_addr and remote_addr give the IP-addresses used at both ends of the link in dotted quad notation. In our case, the ip-up script may contain the following code fragment:
           #!/bin/sh
           case $5 in
           191.72.3.1)            # this is sub-etha
                   route add -net 191.72.3.0 gw 191.72.3.1;;
           esac
           exit 0

In a similar fashion, /etc/ppp/ip-down is used to undo all actions of ip-up after the PPP link has been taken down again.

However, the routing scheme is not yet complete. We have set up routing table entries on both PPP hosts, but so far, all other hosts on both networks don't know anything about the PPP link. This is not a big problem if all hosts at the subsidiary have their default route pointing at sub-etha, and all Brewery hosts route to vlager by default. If this is not the case, your only option will usually be to use a routing daemon like gated. After creating the network route on vlager, the routing daemon would broadcast the new route to all hosts on the attached subnets.


contents
Next: Link Control Options Up: IP Configuration Options Previous: Choosing IP Addresses

Andrew Anderson
Thu Mar 7 23:22:06 EST 1996