Библиотека сайта rus-linux.net
Next: Configuring a Gateway Up: Interface Configuration for IP Previous: Ethernet Interfaces
Routing through a Gateway
In the previous section, I covered only the case of setting up a host on a single Ethernet. Quite frequently, however, one encounters networks connected to one another by gateways. These gateways may simply link two or more Ethernets, but may provide a link to the outside world, the Internet, as well. In order to use the service of a gateway, you have to provide additional routing information to the networking layer.For instance, the Ethernets of the Virtual Brewery and the Virtual Winery are linked through such a gateway, namely the host vlager. Assuming that vlager has already been configured, we only have to add another entry to vstout's routing table that tells the kernel it can reach all hosts on the Winery's network through vlager. The appropriate incantation of route is shown below; the gw keyword tells it that the next argument denotes a gateway.
# route add wine-net gw vlagerOf course, any host on the Winery network you wish to talk to must have a corresponding routing entry for the Brewery's network, otherwise you would only be able to send data from vstout to vbardolino, but any response returned by the latter would go into the great bit bucket.
This example describes only a gateway that switches packets between two isolated Ethernets. Now assume that vlager also has a connection to the Internet (say, through an additional SLIP link). Then we would want datagrams to any destination network other than the Brewery to be handed to vlager. This can be accomplished by making it the default gateway for vstout:
# route add default gw vlagerThe network name default is a shorthand for 0.0.0.0, which denotes the default route. You do not have to add this name to /etc/networks, because it is built into route.
When you see high packet loss rates when pinging a host behind one or more gateways, this may hint at a very congested network. Packet loss is not so much due to technical deficiencies as due to temporary excess loads on forwarding hosts, which makes them delay or even drop incoming datagrams.
Next: Configuring a Gateway Up: Interface Configuration for IP Previous: Ethernet Interfaces Andrew Anderson
Thu Mar 7 23:22:06 EST 1996