Routing Processes

The IP routing processes on all nodes involved in the delivery of an IP packet includes: the sending host, the intermediate routers, and the destination host.

IP on the Sending Host

When a packet is sent by a sending host, the packet is handed from an upper layer protocol (TCP, UDP, or ICMP) to IP. IP on the sending host does the following:

  1. Sets the Time-to-Live (TTL) value to either a default or application-specified value.

  2. IP checks its routing table for the best route to the destination IP address.
    If no route is found, IP indicates a routing error to the upper layer protocol (TCP, UDP, or ICMP).

  3. Based on the most specific route, IP determines the forwarding IP address and the interface to be used for forwarding the packet.

  4. IP hands the packet, the forwarding IP address, and the interface to Address Resolution Protocol (ARP), and then ARP resolves the forwarding IP address to its media access control (MAC) address and forwards the packet.

IP on the Router

When a packet is received at a router, the packet is passed to IP. IP on the router does the following:

  1. IP verifies the IP header checksum.
    If the IP header checksum fails, the IP packet is discarded without notification to the user. This is known as a silent discard .

  2. IP verifies whether the destination IP address in the IP datagram corresponds to an IP address assigned to a router interface.
    If so, the router processes the IP datagram as the destination host (see step 3 in the following "IP on the Destination Host" section).

  3. If the destination IP address is not the router, IP decreases the time-to-live (TTL) by 1.
    If the TTL is 0, the router discards the packet and sends an ICMP Time Expired-TTL Expired message to the sender.

  4. If the TTL is 1 or greater, IP updates the TTL field and calculates a new IP header checksum.

  5. IP checks its routing table for the best route to the destination IP address in the IP datagram.
    If no route is found, the router discards the packet and sends an ICMP Destination Unreachable-Network Unreachable message to the sender.

  6. Based on the best route found, IP determines the forwarding IP address and the interface to be used for forwarding the packet.

  7. IP hands the packet, the forwarding IP address, and the interface to ARP, and then ARP forwards the packet to the appropriate MAC address.

This entire process is repeated at each router in the path between the source and destination host.

IP on the Destination Host

When a packet is received at the destination host, it is passed up to IP. IP on the destination host does the following:

  1. IP verifies the IP header checksum.
    If the IP header checksum fails, the IP packet is silently discarded.

  2. IP verifies that the destination IP address in the IP datagram corresponds to an IP address assigned to the host.
    If the destination IP address is not assigned to the host, the IP packet is silently discarded.

  3. Based on the IP protocol field, IP passes the IP datagram without the IP header to the appropriate upper-level protocol.
    If the protocol does not exist, ICMP sends a Destination Unreachable-Protocol Unreachable message back to the sender.

  4. For TCP and UDP packets, the destination port is checked and the TCP segment or UDP header is processed.
    If no application exists for the UDP port number, ICMP sends a Destination Unreachable-Port Unreachable message back to the sender. If no application exists for the TCP port number, TCP sends a Connection Reset segment back to the sender.