Understanding Routing with IP
To minimize unnecessary traffic load and to provide efficient movement of frames from one location to another, the interconnected hosts are grouped into separate networks. As a result of this grouping (which is determined by the network designer and administrator) it is possible for an interconnect device to determine the best path between two networks.
This interconnect device, by definition, is called a router. A router, operating at Layer 3, the Network Layer, forms the boundary between one network and another network. When a frame crosses a router it is in a different network. A frame that travels from source to destination without crossing a router has remained in the same network. A network is a group of communicating machines bounded by routers.
The router will use some of the bits in the IP address to identify the network location to which the frame is destined. The remaining bits in the address will uniquely identify the host on that network that will ultimately receive the frame.
It is necessary to differentiate between the bits used to identify the network and those used to identify the host. The sender of a frame must make this differentiation because it must decide whether it is on the same network as the destination or on a different network. If the sender is on the same network as the destination, it will determine the data link address of the destination machine. Then it will send the frame directly to the destination machine.
On the other hand, if the destination is on a different then the originator must send the frame to a router and let the router forward the frame on to the ultimate destination network. At the ultimate destination network the last router must determine the data link address of the host and forward the frame directly to that host on that ultimate destination network.
When a router receives an incoming data frame it masks the destination address to create a lookup key that is compared to the entries in its routing table. The routing table indicates how the frame should be processed.
The frame might be delivered directly on a particular port on the router. The frame might have to be sent on to the next router in line for ultimate delivery to some remote network. The routing table contains this information. The routing table is created by the combination of direct configuration by the administrator or dynamically through the periodic broadcasting of router update frames. Protocols like RIP (Routing Information Protocol), OSPF (Open Shortest Path First), and Cisco’s IGRP (Internet Gateway Routing Protocol) are sent from all routers at periodic intervals. As a result, all routers become aware of how to reach all other networks.
Consider this example:
A network consists of three routers with four segments:
The routers use the mask value 255.255.0.0. The routing table in the router between 18.104.22.168 and 22.214.171.124 says:
|Result of Mask||Do this with the frame|
|126.96.36.199||ARP for destination on Port #1 and deliver directly|
|188.8.131.52||ARP for destination on Port #2 and deliver directly|
|184.108.40.206||Forward frame to next router: 220.127.116.11|
|18.104.22.168||Forward frame to next router: 22.214.171.124|
Study this example to understand the relationship between the routing table and the physical network. Assume you are an end-node attached to Network 126.96.36.199. If you want to send a frame to a destination on Network 188.8.131.52 you will send the frame to the router. The router knows to deliver the frame directly on the appropriate port. If the frame were destined to network 184.108.40.206 then the router would know the forward the frame to the next router in line, in this example it is identified as 220.127.116.11. 18.104.22.168 would then deliver the frame directly on its own port to network 22.214.171.124.
Because of the masking process the router knows that some station, perhaps 126.96.36.199, is on the same network as 188.8.131.52. The masking of both these addresses produces 184.108.40.206 which is looked-up in the table. All frames destined to 220.127.116.11 are sent correctly. The router doesn’t have to keep track of all end- nodes individually. Because the end-nodes are grouped together into networks the router can process the frames without the need for a massive list of all stations in the known universe.
Additional Information about IP Routing
RFC 1812: The specific behavior that is expected from an IP router is discussed in RFC 1812. This is a somewhat lengthy document but it does provide a complete discussion of routing in the IP Version 4 network environment.