Routing turns TCP/IP networks into an internet and is an essential function of the Internet Protocol (IP). Even a Linux system, which has the Transport layer and the Application layer sitting above the IP layer, makes routing decisions in the IP layer. When the IP layer receives a packet, it evaluates the destination address in the header of the packet, as follows:
• If the destination address is the address of the local computer, IP evaluates the protocol number and passes the packet up to the appropriate transport protocol. (See the discussion of protocol numbers in Chapter 3, "Login Services.")
• If the destination address is on a directly connected network, IP delivers the packet to the destination host.
• If the destination is on a remote network, IP forwards the datagram to a local router. The router that the packet is sent to must share a physical network with the local system. It is the responsibility of that router to then forward the packet on to the next router and so on, hop by hop, until the packet reaches its destination.
Based on this list of possible decisions, IP will either directly deliver the packet or forward it to a router for additional processing. From reading Chapter 3, you know how IP uses the protocol number and the port number to deliver data to the correct application within the local host. But you may not yet know how IP delivers data across a network. To deliver a packet to another host on a directly attached network, IP must use the Physical layer addressing of that network by converting the IP address to a Physical layer address.
Was this article helpful?