TCP / IP IP routing Comments

TCP / IP IP routing Comments

In this article which will be described an IP routing process by way of example

TCP / IP network routing

As shown, the host A and host B are in different subnets which, through an intermediate connection routing. If the host A process request for access host B, to find the position of the host A to host B will be appreciated that the IP routing for the selection process.

Now the user of host A Ping command to confirm connectivity with the host B Ping command appears to be simple, but in which IP routing process there are several steps or the specific steps are as follows:

  1. After entering the host A 12.34.56.78, Internet Control Message Protocol (ICMP) host A to create a response request packet, the data field contains only letters.

  2. ICMP protocol will respond just created request packet (payload) transmitted to the Internet Protocol (IP protocol). IP protocol will encapsulate the packet to create a packet. In the packet IP protocol created, including the IP address of host A, the IP address of the destination host B and the protocol field value of 01h. When the packet reaches the host B, host B is determined by the protocol field 01h, this payload to the ICMP protocol processing.

  3. After creating a packet IP protocol, the IP address of the destination host determines B is in the local network or in a remote network. According to the rules of the IP address, host A, B belong to different networks. At this point the packet IP protocol created will be sent to the default gateway. (In each terminal device, network configuration needs to include its own IP address, and the default gateway address in the host between different networks communicate with each other, is to rely on the gateway device)

  4. As shown, the default gateway is the router in FIG. At this point we need to confirm the MAC address of the router. Suppose A corresponding router connected to the host network interface router IP address 10.142.149.1, then the host A (10.142.149.6) is configured as the default gateway 10.142.149.1 ,. To now IP packets to the network interface corresponding router 10.142.149.1, it is necessary to know the physical address of this interface, i.e. MAC address. Only know the MAC address, IP packets can be transferred from it to the underlying network layer and the data link layer generates a frame according to the rules of the link layer. After the host A to the link layer packet to the IP address of the router interface 10.142.149.1. A local area network, the host can only communicate with each other through the hardware address. A host when the data is to be sent to the corresponding packet router interface, the router must know the MAC address corresponding to this advance. Then you need to use the ARP protocol, later to explain the specific ARP protocol will write a separate note for analysis. Host A will first check the local ARP cache to see if a default gateway IP address corresponding to the MAC address of the router interface. If there is a corresponding record ARP cache table containing the IP address has been successfully resolved. In this case, IP layer will be transferred to the data packet and the data link layer generates a frame. Wherein the MAC address of the destination host B will be passed along to the data packet and the data link layer. Typically, the host A, the host can view the current IP address and MAC address correspondence table by ARP command.

  5. Generating a data frame. When the MAC address of the destination host, and IP packet B is transmitted to the data link layer, the LAN driver for providing access to media services to Ethernet data transmission. By some control information for encapsulating IP packets, forming data frames. Data frame includes the MAC address of the destination host and the source host B to A, and an Ethernet type field. Ethertype field mainly used to describe the delivery of the packet to the network layer protocol data link layer. End of the data frame is referred to as a frame check sequence field, its loading area redundancy check cycle Calcd. To summarize, in this example, the data link layer of the host A generates data frame including destination MAC address (refer to corresponding MAC address of the router interface), Host A own MAC address, an Ethernet type field, data packet frame check sequence. Note: This transmission process, the destination address is not the MAC address of Host B, but Host A MAC address corresponding to the router interface. The last data frame to the physical layer transmission (bit) in the form of bits.

  6. Router interface receives these bits (bit) and re-combined into a data frame. After acceptance, the CRC will process the content and the frame check sequence field collation stored. If the values ​​do not match each other, the data frame will be discarded. If the two values ​​are the same, then the router interface will be transmitted by the host A receives the data frame, and verifies the MAC address of the destination of the data placed in the frame, matches the own MAC address. Routers also view the data type field of the Ethernet frame to understand the type of the network layer protocol employed, the router will then extracted packet data frame, and discard the rest. Extracting the data packets transmitted to the upper layer protocol type field in the Ethernet listed. In the present embodiment, the IP protocol.

  7. IP protocol after receiving the packet, checks the destination IP address. In the present embodiment, since the destination address of any address in the packet receiving router is not configured to match, so the address of the destination router looks at the IP network in its routing table. In the present embodiment, because the router also connects 10.142.148.10, so in this router in the routing table, related records. If no relevant records, then the packet is discarded directly. After the packet is discarded, it will send an error message "unreachable destination address" to the host A.

  8. If the router finds a network address corresponding to the record in its routing table, then the packet is forwarded to the output interface of the router. In the present embodiment, the router is used to interface with the host B. The packet router will exchange into the corresponding interface buffer.

  9. Then there is the router interface buffer handling of data packets. This interface buffer needs to know the MAC address of the destination address of the host B. Because now includes the IP address of the destination host B data packet, the router based on the IP address checking the local ARP cache table, if the MAC address of Host B has been resolved and cached in the ARP cache of the router in this packet and MAC address of host B will be transmitted to the data link layer in order to regenerate the data frame. In the case with the previous router host B communicate over, the mapping records the IP and MAC address of host B in the router caches four hours. More than four hours, then no further communication, IP and MAC address mapping records will be deleted. If there is no mapping in the router ARP buffer record table, the router sends an ARP request interface is internally connected to the subnet. ARP request is broadcast, all the internal subnet hosts will be subject to this request, they found the body of this request is the MAC address of 10.142.148.10. Then each host checks its own IP address, no match is found, it will discard the ARP request packet. The Host B checks its own IP address, a successful match is found, then host B will respond to its own MAC address to the router. Thus it is possible to know the IP address of the router and the MAC address of the destination host B, it will pass the packet and the destination MAC address of the host B to the data link layer in the bottom. Then of course, also the IP address of the host router and the MAC address buffer B to its ARP cache table, the next use.

  10. Router then generates a data frame transmitted to the physical layer, so as to transmit the bit to the physical media, for transmission over the network medium.

  11. Host B CRC check process upon receiving the data frame. Check result and frame check sequence field in the same content, then the MAC address of the destination of the data frame are read, and the host B will be its own MAC address is the same than the MAC address. If the same, it will extract the data packet therein and specified field type according to the Ethernet protocol, the data packets transmitted to the corresponding protocol processing. In the present embodiment, the data packet is a response to the request, the host B will eventually to the packet processing ICMP protocol. ICMP protocol will answer this request, the packet is discarded while the quickly generate a new response in response payload. Then Host B will use the same procedure to pass the data packet and a destination MAC address to the next layer, you generate a data frame transmitted to a corresponding router interface through the physical medium.

  12. Repeat steps router corresponding to the above, the data packet to be transmitted is transmitted on another interface, then host A receives a response acknowledgment information indicating host A to host B network is through.

Summary : The above basically describes the entire process of IP routing. In Benpian notes, lists examples of a router node. As in the case of multi-router forwarding is also the same reason, to reach each router will first search the routing table to determine where the next data is transferred to or dropped. Steps are substantially the same, for the IP packet, which flows in the network is basically a routine:

  • After the transport layer of the data to the host A network layer, the network layer IP header is added, both as an IP address, TTL information, referred to as encapsulated IP packets, and the destination MAC address acquired by the ARP protocol, the data packets to link layer.
  • The data link layer IP, MAC address, encapsulating the data frame is a physical frame transmitted by the physical media.
  • Host B receives a physical frame, a MAC address is determined. If a match with its own MAC address, the data frame to put the network layer processing.
  • Network layer IP address matches judge, if it is sent to their own, and then transfer the upper layer protocol processing; if not, to find the next hop address for this IP address in the routing table, and the data from the memory card to accept data IP program to copy the data to send the IP address of the network card. In the transmission interface by ARP request to obtain the MAC address of the next hop, the IP packet program and destination MAC addresses to a data link layer, and then encapsulated into a data frame, the data frame transmitted through the physical medium.

In the process of IP routing, we can see the role of the routing table is indispensable. Address of the next hop the packet is discarded directly, are closely related to the routing table. The next note will briefly explain the form and function of the routing table.

Guess you like

Origin www.cnblogs.com/Dr-wei/p/11966224.html