In a connectionless packet delivery system, the basic unit of transfer is the IP datagram. The routing problem is characterised by describing how routers forward IP datagrams and deliver them to their destinations. In a packet switching system, ‘routing’ refers to the process of choosing a path over which to send packets.
Unlike routing within a single network, the IP routing must choose the appropriate algorithm for how to send a datagram across multiple physical networks. In fact, routing over the Internet is generally difficult because many computers have multiple physical network connections.
To understand IP routing, a TCP/IP architecture should be reviewed completely. The Internet is composed of multiple physical networks interconnected by routers. Each router has direct connections to two or more networks, while a host usually connects directly to one physical network.
However, it is possible to have a multihomed host connected directly to multiple network. Packet delivery through a network can be managed at any layer in the OSI stack model. The physical layer is governed by the Media Access Control (MAC) address; the data link layer includes the Logical Link Control (LLC); and the network layer is where most routing takes place.
The delivery of an IP packet to its final destination is accomplished by means of either direct or indirect delivery. Direct delivery occurs when the source and destination of the packet are located on the same physical network.
The sender can easily determine whether the delivery is direct or not by extracting the network (IP) address of the destination packet and comparing this address with the addresses of the networks to which it is connected. If a match is found, the delivery is direct.
In direct delivery, the sender uses the senders IP address to find the destination physical address. This mapping process can be done by Address Resolution Protocol (ARP). If the destination host is not on the same network as the source host, the packet will be delivered indirectly.
In an indirect delivery, the packet goes from router to router through a number of networks until it reaches one that is connected to the same physical network as its final destination. Thus, the last delivery is always a direct delivery, which always occurs after zero or more indirect deliveries.
In an indirect delivery, the sender uses the destination IP address and a routing table to find the IP address of the next router to which the packet should be delivered. The sender then uses the ARP to find the physical address of the next router.