Simplified IP datagram routing algorithm
To route an IP datagram on the network, the algorithm shown in Figure 1 is used.
Figure 1. General IP routing
algorithm
Using this general routing algorithm, it is easy to determine
where an IP datagram is routed. Following is a simple example based
on the configuration shown in Figure 1.
Machine A IP Address = 192.9.200.1
Routing Table
Destination Gateway
192.9.200.1 192.9.200.1 (Machine A's network interface)
9.0.0.0 192.9.200.2 (Route to the 9.n.n.n address is
via Machine D, 192.9.200.2)
Machine A sends a datagram to host 192.9.200.3 (Machine B), using the direct route, 192.9.200.1 (its own network interface). Machine A sends a datagram to host 9.67.32.2 (Machine C), using the indirect route, 192.9.200.2 (Machine D), and Machine D then forwards the datagram to Machine C.