Misunderstandings of computer network --- source-destination IP and source-destination MAC changes

Table of contents

 1. First give the conclusion:

Second, the second analysis of the reasons


      This is an old-fashioned question, and it will be encountered in many university exams, grades, and certificates. Today I will briefly talk about this question.

 1. First give the conclusion:

1. The source IP address and the destination IP address of the data packet remain unchanged during the transmission process.
2. Every time the data packet passes through the switch, the source and destination MAC address remains unchanged.
3. Every time the data packet passes through the router, the source MAC address is the MAC address of the router interface, and the destination MAC address For the destination IP address, create a MAC address corresponding to the IP address.
4. For the data packet sent by the computer, if the destination IP and the local IP are in the same network segment, then the destination MAC address is the MAC address corresponding to the destination IP address; if it is not a network segment, then the destination MAC address is the MAC address of the gateway.
5. Of course, the formation of the above conclusions does not consider special circumstances such as NAT and VPN.

Second, the second analysis of the reasons

        The source-destination IP and source-destination MAC change problem is actually a data packet forwarding problem in the computer network and a data packet encapsulation problem in the TCP/IP protocol. It involves two levels, the network layer and the data link layer.
At the network layer, IP addresses are used for packet addressing; at the data link layer, MAC addresses are used for packet addressing.

Note:
1. The default LAN type here is Ethernet. If the network type is not Ethernet, the MAC address may not be encapsulated at all when encapsulating the data link layer.
2. Don't ask why the link layer uses MAC addresses, while the network layer uses IP addresses. This is designed by the inventors of computer networks. In fact, it is convenient for development and routing considerations.

        Based on this, at the network layer level, since the source and destination IPs are the same, the source and destination IPs will definitely not change during the data packet transmission process. On the data link level, since the data packet needs to be routed and forwarded during the transmission process, the source and destination MAC addresses will continue to change.
        Visually speaking, sending a data packet is like sending a letter, and the source and destination IP are like the letter writer and receiver, so the source and destination IP will not change. However, the letter will go through multiple transfers from the letter writer to the receiver, and the MAC address is equivalent to playing a role in the transfer process. The MAC address indicates which transfer station to be delivered to, so the MAC address will continue to be transferred. Variety. 

Guess you like

Origin blog.csdn.net/w2685797168/article/details/129827526