old-www/LDP/nag/node116.html

110 lines
4.7 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<!--Converted with LaTeX2HTML 96.1-c (Feb 29, 1996) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds -->
<HTML>
<HEAD>
<TITLE>Routing Through a PPP Link</TITLE>
</HEAD>
<BODY LANG="EN">
<A HREF="node1.html"><IMG WIDTH=65 HEIGHT=24 ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif"></A> <BR>
<B> Next:</B> <A HREF="node117.html">Link Control Options</A>
<B>Up:</B> <A HREF="node114.html">IP Configuration Options</A>
<B> Previous:</B> <A HREF="node115.html">Choosing IP Addresses</A>
<BR> <P>
<H2><A NAME="SECTION0010720000">Routing Through a PPP Link</A></H2>
<A NAME="4300"></A>
<A NAME="4301"></A>
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.
<P>
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.
<P>
<A NAME="4305"></A>
<A NAME="4306"></A>
<A NAME="4307"></A>
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.
<P>
<A NAME="4315"></A>
<A NAME="4316"></A>
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.
<P>
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..
<P>
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:
<Pre>
ip-up iface device speed local addr remote addr
</Pre>
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:
<Pre>
#!/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
</Pre>
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.
<P>
<A NAME="4347"></A>
<A NAME="4550"></A>
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.
<P>
<A NAME="4353"></A>
<P>
<HR><A HREF="node1.html"><IMG WIDTH=65 HEIGHT=24 ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif"></A> <BR>
<B> Next:</B> <A HREF="node117.html">Link Control Options</A>
<B>Up:</B> <A HREF="node114.html">IP Configuration Options</A>
<B> Previous:</B> <A HREF="node115.html">Choosing IP Addresses</A>
<P><ADDRESS>
<I>Andrew Anderson <BR>
Thu Mar 7 23:22:06 EST 1996</I>
</ADDRESS>
</BODY>
</HTML>