UNIX System Administration Handbook - Evi Nemeth [208]
Exhibit B Ethernet packet
See page 269 for more information about Ethernet vs. IP addressing.
The Ethernet destination hardware address is that of router R1, but the IP packet hidden within the Ethernet frame does not mention R1 at all. When R1 inspects the packet it has received, it will see from the IP destination address that it is not the ultimate destination of the packet. It will then use its own routing table to forward the packet to host B without rewriting the IP header, so that it still shows the packet coming from A.
Here’s the routing table for host R1:
R1% netstat -rn
Routing tables
Destination Gateway Flags Refs Use If
127.0.0.1 127.0.0.1 UH 10 10233 lo0
199.165.146.0 199.165.146.1 U 15 4529 le1
199.165.145.0 199.165.145.24 U 0 121 le0
default 199.165.146.3 UG 4 168589 le1
This table is similar to that of host A, except that there are two physical network interfaces. The default route in this case points to R2, since that’s the gateway through which the Internet can be reached. Packets bound for either of the 199.165 networks can be delivered directly.
Like host A, host B has only one real network interface. However, B needs an additional route to function correctly because it has direct connections to two different routers. Traffic for the 199.165.145 net must travel via R1, while other traffic should go out to the Internet via R2.
B% netstat -rn
Routing tables
Destination Gateway Flags Refs Use If
127.0.0.1 127.0.0.1 UH 2 1543 lo0
199.165.146.0 199.165.146.4 U 15 4529 le0
199.165.145.0 199.165.146.1 UG 0 121 le0
default 199.165.146.3 UG 4 168589 le0
It is possible to configure host B with initial knowledge of only one gateway, thus relying on the help of ICMP redirects to eliminate extra hops. For example, one possible initial configuration for host B is:
B% netstat -rn
Routing tables
Destination Gateway Flags Refs Use If
127.0.0.1 127.0.0.1 UH 2 1543 lo0
199.165.146.0 199.165.146.4 U 15 4529 le0
default 199.165.146.3 UG 4 168589 le0
See page 285 for an explanation of ICMP redirects.
If B then sends a packet to host A (199.165.145.17), no route will match and the packet will be forwarded to R2 for delivery. R2 (which, being a router, presumably has complete information about the network) will send the packet on to R1. Since R1 and B are on the same network, R2 will also send an ICMP redirect notice to B, and B will enter a host route for A into its routing table:
199.165.145.17 199.165.146.1 UGHD 0 1 le0
This route will send all future traffic for A directly through R1. However, it does not affect routing for other hosts on A’s network, all of which will have to be routed by separate redirects from R2.
Some sites have chosen ICMP redirects as their primary routing “protocol,” thinking that this approach is very dynamic. Unfortunately, once the kernel learns a route from a redirect, either the route must be manually deleted or the machine must be rebooted if that information changes. Because of this problem and several other disadvantages of redirects (increased network load, increased load on R2, routing table clutter, dependence on extra servers), we don’t recommend the use of redirects for configurations such as this. In a properly configured network, redirects should never appear in the routing table.
14.2 ROUTING DAEMONS AND ROUTING PROTOCOLS
In simple networks such as the one shown in Exhibit A, it is perfectly reasonable to configure routing by hand. At some point, however, networks become too complicated to be managed this way (possibly due to their growth rate). Instead of having to explicitly tell every computer on every network how to reach every other computer and network,