Analysis of IP packet transmission through vro

Source: Internet
Author: User

An Analysis of the transmission of an IP packet through a router transmission through a router. Each host and route has a routing table ). The route table specifies the route for the IP address of the destination to be sent. It's like a road sign. if the address is "Tokyo", turn to the left. If the address is "Sydney", turn to the right. A real world routing table for example, we generate an IP packet sent to 145.17 from host 146.21: Spread the letter paper and write the beginning of the letter (the rest of the data can be a tcp packet or a udp packet, it can also be any Garbled word that we do not care about for the moment), indicating the destination IP address (199.165.146.21) and the outbound IP address (199.165.145.17 ). Host 145.17 then references its own routing table, which contains three rows of records: 145.17 routing table (Genmask is the subnet mask, Iface is used to describe which Nic interface is used) destination Gateway Genmask Iface 199.165.145.0 0.0.0.0 255.255.255.0 eth0 0.0.0.0 199.165.145.17 0.0.0.0 eth0 there are two rows of records. The first line indicates that if the IP address destination is a host on the network of 199.165.145.0, you only need to transmit the IP address directly from the network adapter on eth0 ("local community": direct delivery ), you do not need to go to the router (Gateway 0.0.0.0 = "local mail "). The second line indicates that all IP addresses that do not match the first line should be sent to Gateway 199.165.145.17, that is, the IP address of the NIC connected by the Intermediate router in eth0 (the branch of the Post Office in eth0 ). The destination of our IP package is 199.165.146.21, which does not conform to the first line. Therefore, it is sent to the middle router according to the second line. Host 145.17 will put the IP packet into the payload of the frame, and write the MAC address corresponding to 199.165.145.17 in the frame header, so that the packets can be transmitted in the LAN according to the method in the small horn. After the middle router receives the IP packet (in fact, it receives the frames of the Ethernet protocol, and then reads the IP packet from the payload in the frame), extracts the destination IP address, and then compares it with its own routing table: destination Gateway Genmask Iface 199.165.145.0 0.0.0.0 255.255.255.0 eth0 199.165.146.0 0.0.0.0 255.255.255.0 eth1 0.0.0.0 255.0.0.0.0 eth1 we can see from the first two lines that the router spans eth0 and eth1, it can directly transmit IP packets through the network adapter on eth0 and eth1. The third line indicates that if the IP address is outside the first two lines, it must be sent to 199.165.146.8 (the router on the right) through eth1 ). Our destination conforms to the second line, so we put the IP into a new frame, write the MAC address 199.165.146.21 in the frame header, and send it directly to host 146.21. (In Linux, you can use $ route-n to view the routing table.) IP packets can be further relayed to a host farther away. The IP packet starts from the host and is indirectly loaded on the router according to the routing table of the router along the route. The IP package eventually reaches a certain router. the router and the target host are located in a LAN and can directly establish communication at the connection layer. Finally, the IP packet is sent to the target host. This process is called routing (we call it IP packet relay, and the word routing is too much mixed ). During the whole process, IP packets are constantly encapsulated into frames (envelopes) by hosts and routes, and then transmitted between NICs in the LAN Using the connection layer. During the entire process, the content of our IP package remains complete and remains unchanged. The final result is that an IP packet is transferred from one host to another. Using the IP package, we don't need to worry about what happens at the underlying layer (such as the connection Layer.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.