Understanding IP Routing Processes
Understanding IP Routing Processes
After de-encapsulation, the router takes the following steps to decide where to forward an IP packet: It checks the destination IP address of the packet against its routing table. The router selects the best matching entry using the longest prefix match algorithm. The entry indicates the next destination or interface for packet egress, including the necessary encapsulation type for the outgoing link, such as Ethernet, HDLC, or PPP. The router then encapsulates the packet into a suitable frame and transmits it through the chosen interface .
Routers differ from regular hosts in their handling of frames because they use additional steps to forward packets between different networks. While a regular host primarily sends packets to its local subnet or default gateway, a router processes incoming frames to decide if it should be de-encapsulated based on MAC address checks and FCS validation. Once de-encapsulated, the router examines the packet's destination IP address against its routing table to determine the appropriate outgoing interface. Finally, routers encapsulate the packet in a new data-link frame specific to the outgoing link type before transmission .
Encapsulation is crucial in the IP routing process because it allows the IP packet to be transmitted over different types of data-link layers, enabling communication across various network media. The encapsulation process varies between interface types; for example, Ethernet interfaces encapsulate packets in Ethernet frames with MAC addresses, while serial interfaces often use encapsulation like HDLC or PPP, which do not include MAC addressing. This ensures the packet is compatible with the physical and data-link layer requirements of the specific transmission medium .
When a LAN-based host transmits an IP packet to a non-local destination, it follows these steps: It first determines that the destination address is not part of its local subnet. The host then sends the packet to its default gateway by encapsulating the IP packet in a data-link frame with the destination MAC address as the default gateway's MAC. The default gateway is usually the router that connects to other subnets or external networks. The host finds the default gateway’s MAC address using Address Resolution Protocol (ARP).
The Frame Check Sequence (FCS) is a field used to detect errors in the transmitted frames. When a router receives a frame, it checks the FCS to determine whether the frame has been corrupted during transmission. Only frames that pass the FCS check, indicating they are error-free, are processed by the router. Frames with errors are discarded, ensuring that only valid frames are propagated through the network .
Address Resolution Protocol (ARP) is used during IP routing to map IP addresses to MAC addresses, which are needed for encapsulating the IP packet in a data-link frame. When a host or router does not have the MAC address of the destination or the next-hop router, they use ARP to request this information from the network. For example, a host will use ARP to find the MAC address of its default gateway, while a router will use ARP to resolve the MAC address of the next-hop device on the route .
Routers handle unknown unicast frames by generally ignoring them since these frames are not addressed to the router's MAC address. This process is necessary to maintain network efficiency and to ensure that the router does not engage in unnecessary processing of frames not intended for it, which could otherwise waste valuable computational resources and bandwidth. LAN switches, instead, are responsible for flooding these unknown unicast frames to all ports to find the frame’s destination .
A router determines the correct MAC address for an Ethernet frame by consulting its ARP table to find the MAC address associated with the next hop's IP address. If the necessary entry is not present in the ARP table, the router will send an ARP request packet on the network to discover the MAC address of the device with the specific IP address. Once the MAC address is obtained, the router encapsulates the IP packet in an Ethernet frame with the destination MAC address set to the one it discovered, ensuring correct delivery .
A router uses HDLC as the encapsulation protocol on point-to-point serial WAN links. For instance, consider a network where routers are connected over a leased serial line. When forwarding a packet, the router de-encapsulates the original LAN frame, selects HDLC as the encapsulation protocol for the serial link, and then re-encapsulates the IP packet into an HDLC frame. This HDLC frame is then transmitted over the serial link towards the next router or towards its final destination .
A router uses the IP routing table to make forwarding decisions by comparing the destination IP address of the received packet with entries in the routing table. The routing table contains multiple routes, each including a subnet ID and subnet mask. By using this information, the router determines the best match subnet for the destination address and then uses the corresponding forwarding information to decide where to send the packet next .