let's start by understanding the following basic concepts :
1. Forwarding: Represents the process of selecting a path for a group
2, IP Forwarding: Its traditional method is IP routing (IP routing), IP forwarding it is to send the datagram to select the path.
3, Group: (most computer networks can not continuously transmit arbitrary long data, so the network system actually divides the data into small pieces, and then block-by-piece, this small block is called the Grouping (packet). Some books also define groupings as protocol data units for the network layer.
4, packet Forwarding (forwarding): Refers to the router forwarding IP packet in the Internet the physical transmission process and datagram forwarding mechanism. Depending on whether the destination IP address of the packet belongs to the same subnet as the source IP address, it can be divided into direct forward and indirect forwarding.
5. Datagram: A datagram is a basic unit of data transmitted over a network, containing a header and the data itself, where the header describes the destination of the data and the relationship to other data
6. IP datagram: A packet transmitted over the network as defined by the TCP/IP protocol
IP datagram forwarding algorithm or router forwarding packet process
1. The router extracts the destination IP address D from the received datagram and calculates the network prefix n for address D
2. Next, the router checks the routing table and, if the table contains a specific route for D, sends the datagram to the next hop specified in the table and exits. Otherwise, go to step 3
3. The router checks if n matches any of the routers ' directly connected network addresses, and if so, delivers the datagram to destination D via the network. Otherwise, go to step 4
4. The router checks the routing table to see if the table contains a route for network N, and if so, the datagram is sent to the fatal next hop in the table. Otherwise, go to step 5
5. The router checks the routing table to see if a default route is included in the table, and if so, sends the datagram to the default router indicated in the table. Otherwise, go to step 6
6. The router will issue a forwarding error