7.2. The Minimal Routing Table
% netstat -rn Routing Table: IPv4 Destination Gateway Flags Ref Use Interface -------------------- -------------------- ----- ----- ------ --------- 172.16.12.0 172.16.12.15 U 1 8 dnet0 18.104.22.168 172.16.12.15 U 1 0 dnet0 127.0.0.1 127.0.0.1 UH 20 3577 lo0
The first entry is the route to network 172.16.12.0 through interface dnet0. Address 172.16.12.15 is not a remote gateway address; it is the address assigned to the dnet0 interface on this host. The other two entries do not define routes to real physical networks; both are special software conventions. 22.214.171.124 is the multicast address. This entry tells Solaris to send multicast addresses to interface 172.16.12.15 for delivery. The last entry is the loopback route to localhost created when lo0 was configured.
Look at the Flags field for these entries. All entries have the U (up) flag set, indicating that they are ready to be used, but no entry has the G (gateway) flag set. The G flag indicates that an external gateway is used. The G flag is not set because all of these routes are direct routes through local interfaces, not through external gateways.
The loopback route also has the H (host) flag set. This indicates that only one host can be reached through this route. The meaning of this flag becomes clear when you look at the Destination field for the loopback entry. It shows that the destination is a host address, not a network address. The loopback network address is 127.0.0.0. The destination address shown (127.0.0.1) is the address of localhost, an individual host. Some systems use a route to the loopback network and others use a route to the localhost, but all systems have some route for the loopback interface in the routing table.
Although this routing table has a host-specific route, most routes lead to networks. One reason network routes are used is to reduce the size of the routing table. An organization may have only one network but hundreds of hosts. The Internet has thousands of networks but millions of hosts. A routing table with a route for every host would be unmanageable.
Our sample table contains only one route to a physical network, 172.16.12.0. Therefore, this system can communicate only with hosts located on that network. The limited capability of this routing table is easily verified with the ping command. ping uses the ICMP Echo Message to force a remote host to echo a packet back to the local host. If packets can travel to and from a remote host, it indicates that the two hosts can successfully communicate.
To check the routing table on this system, first ping another host on the local network:
% ping -s crab PING crab.wrotethebook.com: 56 data bytes 64 bytes from crab.wrotethebook.com (172.16.12.1): icmp_seq=0. time=11. ms 64 bytes from crab.wrotethebook.com (172.16.12.1): icmp_seq=1. time=10. ms ^C ----crab.wrotethebook.com PING Statistics---- 2 packets transmitted, 2 packets received, 0% packet loss round-trip (ms) min/avg/max = 10/10/11
ping displays a line of output for each ICMP ECHO_RESPONSE received. When ping is interrupted, it displays some summary statistics. All of this indicates successful communication with crab. But if we check a host that is not on network 172.16.12.0, say a host at O'Reilly, the results are different.
% ping 126.96.36.199 sendto: Network is unreachable
Here the message "sendto: Network is unreachable" indicates that this host does not know how to send data to the network that host 188.8.131.52 is on. There are only three routes in this system's routing table, and none is a route to 184.108.40.206.
Even other subnets on books-net cannot be reached using this routing table. To demonstrate this, ping a host on another subnet. For example:
% ping 172.16.1.2 sendto: Network is unreachable
These ping tests show that the minimal routing table created when the network interfaces were configured allows communication only with other hosts on the local network. If your network does not require access to any other TCP/IP networks, this may be all you need. However, if it does require access to other networks, you must add more routes to the routing table.
Copyright © 2002 O'Reilly & Associates. All rights reserved.