data, the algorithm uses a routing table to select a next-hop router as the next destination for a datagram. The IP address of the selected router is known as the next-hop address. The IP forwarding algorithm states: Given a destination IP address, , and network prefix, : if ( matches a directly connected network address ) Deliver datagram to over that network link; else if ( The routing table contains a route for ) Send datagram to the next-hop address listed in the routing table; else if ( a default route exists ) Send datagram to the default route; else Send a forwarding error message to the originator; When multiple route table entries match, the entry with the longest subnet mask is chosen as it is the most specific one. If there are multiple routes with the same subnet mask, the route with the lowest metric is used. If there are multiple default routes, the metric is also used to determine which to use. If there are multiple routes with the same subnet mask and metric, the system may use equal-cost multi-path routing as a forwarding strategy. When no route is available, an ICMP error message is sent to the originator of the packet, to inform that host that the packet could not be delivered. To avoid unnecessary retransmission to avoid network congestion, the sending host should either stop transmitting or choose another address or route. Routing table The following presents a typical routing table in a Unix-like operating system: Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 71.46.14.1 0.0.0.0 UG 0 0 0 ppp0 10.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 eth0 71.46.14.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0 172.16.0.0 0.0.0.0 255.240.0.0 U 0 0 0 eth0 192.168.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0 192.168.1.0 192.168.96.1 255.255.255.0 UG 0 0 0 eth0 192.168.96.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 The host has several network interfaces. eth0 is the interface name of the network interface card representing an Ethernet port. ppp0 is a PPPoE interface, which is configured as the default route in this example. A default route is recognized by the destination 0.0.0.0 and the flag G. A network router is identified by the network mask 255.255.255.255 and the flag H. Notes References Routing