The following procedure shows how packets are routed to a system
not connected directly to the local network.
See
Figure 5-1, ``Example internetwork'',
for an illustration of the networks described in this example.
The IP layer of the machine thames receives a
packet addressed to
the machine paris at the IP address 132.147.246.3
thames consults its kernel routing table, which may
look like the following:
destination netmask gateway interface
132.147.246.0 255.255.255.0 volga le0
132.147.118.0 255.255.255.0 local le0
default N/A volga le0
As described in the previous example, thames
applies each netmask to the IP address 132.147.246.3
until it finds a match with the destination address.
Having found a destination match, thames uses the gateway and
interface fields of the entry. thames addresses the packet for
the gateway. In this case, the gateway is the machine volga.
thames transmits the packet through the specified interface.
In this case, the interface is to an Ethernet, so thames does a
lookup in the ARP table to translate the IP address
for volga to an Ethernet address for volga.
thames transmits the packet on the Ethernet, and it is received by
volga.
When volga receives the packet, it reads the ultimate
destination IP address.
Finding that the address is not its own, and because volga is
configured as a router, it consults its kernel routing table
as thames did above.
volga finds that the ultimate destination address can be reached
via the local gateway and sends the packet out the local Ethernet
interface addressed to the ultimate destination IP address.