Wireles Networking is a practical guide to planning and building low-cost telecommunications infrastructure. See the editorial for more information....


Forwarding is straightforward compared to addressing and routing. Each time a router receives a data packet, it consults its internal routing table. Starting with the high order (or most significant) bit, the routing table is searched for the entry that matches the most number of bits in the destination address. This is called the address prefix. If an entry with a matching prefix is found in the routing table, then the hop count or time to live (TTL) field is decremented. If the result is zero, then the packet is dropped and an error packet is returned to the sender. Otherwise, the packet is sent to the node or interface specified in the routing table. For example, if the routing table contains these entries

Destination Gateway Genmask Flags Metric Iface U 0 eth1 UG 1 eth1 U 0 eth0 UG 0 eth0

...and a packet arrives with the destination address of, then the router would send it out on interface eth1. If the packet has a destination of, then it would be forwarded to the gateway (since it is more specific and matches more high-order bits than the network route).

A destination of is a special convention referred to as the default gateway. If no other prefixes match the destination address, then the packet is sent to the default gateway. For example, if the destination address was, then the router would forward the packet to (which would presumably send it closer to the ultimate destination, and so on).

If a packet arrives and no entry is found (i.e., there is no default gateway defined and no prefix matches a known route), then the packet is dropped and an error packet is returned to the sender.

The TTL field is used to detect routing loops. Without it, a packet could endlessly be sent back and forth between two routers who each list the other as the next best hop. These kinds of loops can cause so much unnecessary traffic on a network that they threaten its stability. Use of the TTL field doesn't fix routing loops, but it does help to prevent them from destroying a network due to simple misconfiguration.

Last Update: 2007-01-24