Ping in the same network segment & different network segments (most detailed in history)

Source: Internet
Author: User

Through direct and adress way, The routing table knows that port 4 corresponds to the 1.1.1 network segment and the corresponding IP address is 1.1.1.2, Port 5 knows that the corresponding network segment is the 2.1.1 network segment and its IP address is 2.1.1.2, through the ARP table, the router can know the IP address of the MAC address of its 4.5 port.
Host a only know that its own ARP table contains its own IP address corresponding to the MAC address, other b,c only know their IP corresponding to the Mac this table item
Ping under the same network segment (a---B):    at a ping B: 1. See if host B and host A are in the same network segment (via IP address and subnet mask), this                               to find A and B in the same network segment.                         2.ping only when you know the MAC address of B, A's ICMP request message can reach the B-end, b                             due to the fact that A's MAC address is not known in the ARP table, a will send Send an ARP broadcast frame (the destination  mac address is ff-ff-ff-ff-ff-ff, the source MAC address is a mac:00-50-56-c0-00-01, the frame type is arp0806 (ARP type), the hardware type is 1 (Ethernet type), The protocol type is 0800 (IP), the hardware address length: 6 (in bytes), the protocol address length is: 4 (in bytes), the sending side Ethernet address: A's MAC address, the sender IP address is a IP, the destination Ethernet address is full 0 (used to store B's MAC address, the destination IP address is b IP) , after the ARP broadcast frame arrives the switch, the switch learns A's MAC address corresponding port is 1, and broadcasts the ARP frame from the switch 2,3 port, B receives the ARP frame, discovers the destination IP in the frame as its own IP, then wraps its own MAC address in the ARP reply data frame, simultaneously the destination MAC address , source mac, Destination IP, source IP, etc. to make the corresponding changes, sent to the switch, the switch to view the answer ARP frame source MAC address, found in the Switch MAC Address table and no B Mac table entries, then learn b MAC address corresponding port is 3 port, View answer ARP Frame discovery destination Mac is a table entry corresponding to the 1 port that has been learned, the ARP reply frame is sent from Port 1 to a.                           3. At this time, the ARP table for A has a MAC Address table entry for the IP address of B, which is sent at this time                         & nbsp        ICMP Request message: Two-layer header (Mac with MAC address B, Mac with Source Mac) +ip first +ICMP,ICMP request message arrives at the switch, The switch looks at the MAC address of the source MAC address A, and has learned that the MAC address corresponds to a port of 1, then update the age of the bar, the switch to view the destination MAC address in the ARP frame, previously learned the destination MAC address (B's Mac) corresponding to the port of 3, then the ICMP Answer frames from 3 to B                          4.B after receiving this frame, remove the two-layer head, send Now the destination IP of the frame is itself, return an ICMP answer, will send an answer frame: two layer Head (Mac of the purpose Mac becomes a, Mac with source Mac B) +ip+icmp answer arrives at the switch, The switch views the source MAC address of the answer frame corresponding to the Port 3 table entry already exists in the MAC Address table, then update the table item aging time, the switch to view the destination Mac in the frame for a corresponding Port   1 table entry, then send out from 1 port. 5, received ICMP message, Ping succeeded.

The above is a very clear description of the exchange in this detailed process, in the description of a-router-c This cross-network segment of the link ping will ignore the switch process.

Ping across the network segment:
                 1. Host A to view the routing table found that the next hop address is the IP address of the Router 4 port if you want to reach host C, but you do not know the MAC address of Port 4 at this time.                  2. Host A sends the ARP Request message (broadcast), the destination MAC address is ff-ff-ff-ff-ff-ff, The source MAC address is a Mac, the destination IP is Port 4 IP, the source IP is the IP of host a, after reaching Port 4, found that the destination IP address in the ARP request message is Port 4 own IP address, then returns an ARP reply frame, which stores 4 of the MAC address, the source Mac becomes Port 4 's Mac , the destination Mac is a Mac, when the answer frame arrives at a, the ARP table of a has a mapping table entry for the IP and MAC address of Port 4.                  3. A sends an ICMP packet at this point, a two-tier header (Mac with the source MAC address of A, Mac for the destination MAC for Port 4) +ip ( The IP of the source IP is a, the destination IP is 4 IP) The first +ICMP request,icmp message arrives at the router Port 4, stripped two layer head, through the Query route table entry, found that the destination IP of the data frame is port 5 directly connected to the network segment, but do not know the MAC address of C, Then send an ARP request from Port 5 to C, the destination Mac is ff-ff-ff-ff-ff-ff, the source Mac is Port 5 's Mac, the destination IP is the IP of C, the IP address of the source IP is 5 (through the Direct connect route, in the routing table can be checked), after the request arrives at C, C Find the destination IP in the data frame is its own IP, then the IP corresponding to the C MAC address is stored in the ARP answer data frame sent to Port 5, the destination IP is 5 IP, the source IP is the IP of C, the destination Mac is 5 Mac, the source Mac is C Mac.                   4. Port 5 Gets the ARP reply data frame and knows the MAC address of C, then sends the ICMP packet, the second-level header (Mac for the purpose Mac is C, The source Mac is 5 Mac) +ip+icmp request. C received the frame, stripped two layer head, found that the destination IP is its own IP, then return an ICMP answer, when the data frame sent: Two layer header (the purposeMAC address is 5 Mac, the source Mac is C mac) +ip+icmp answer Router 5 port when the frame is received, Peel two layer head, find the routing table, find the destination IP is the router 4 port belongs to the same network segment, then from Port 4 package two layer of hair out, At this point in the two-layer head of the MAC is a Mac (before the Router ARP table has learned the destination IP corresponding Mac), the source MAC for Router 4 Port Mac,                  5. After reaching a, peel the two layer head, find the destination IP for its own IP, receive the ICMP answer message, and Ping succeeds.


Bo Master Original, a word a word knock, reproduced please indicate the source.

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.