IP Forwarding or IP routing is the function of a network device receiving an IP packet, making a decision of where to send the packet next, and then forwarding the packet. Here is the internal forwarding logic used when an IP packet is received:
- Router receives a frame and checks the received FCS, if errors are found the frame is discarded. The router does not try to recover the lost packet.
- If no errors are found, the the router checks the Type field and extracts the packet from the Frame. The Data Link header and trailer are discarded.
- Assuming an IPv4 packet, the header checksum is verified, if the IP header checksum shows a mismatch the packet is discarded. IPv6 packets skip this step as IPv6 headers do not contain a checksum.
- If the IP header checksum passed, the router checks the destination IP address to see if it is one of the locally configured networks on the router. If the packet destination matches an IP on the router the packet has arrived at its destination. The router analyzes the protocol field in the IP header, identifying the upper layer protocol and hands the packets data payload over to the relevant upper protocol driver.
- If the destination address DOES NOT match an IP configured on the router, the packet must continue to be routed to its destination. The router verifies if the TTL is greater than 1, if not the packet is dropped and an ICMP Time Exceeded message is sent to the packet’s sender. (Source IP)
- The router checks its IP routing table for the most specific prefix match of the packets destination IP address.
- a matched entry includes the outgoing interfaces and next hop router, this information is used by the router to look up the next hop routers layer 2 address in the appropriate mapping table suc has ARP, IP/DLCI, dialer maps, etc… This lookup is needed to build a new Data Link frame and optionally dial the proper number.
- Before creating a new frame, the router updates the IP header TTL or Hop Count field require a re-computation of the IPv4 header checksum
- The router encapsulates the IP packet in a new Data Link header and trailer to create a new frame.
This does not contain the logic used for Fast switching or CEF switching.