Get the App
SLTechnology News&Howtos  ›  Servers  › 

Introduction of network layer protocol, detailed explanation of IP packet format + ARP principle (focus 3, necessary knowledge of network rookies)

Shulou Source: shulou.com Published: 2022-06-02 12:10:49 09月28日 Update

one。 Let's first review which layer of the basic seven layers of our network is the network layer.

It is our third layer. This packet contains IP header, TC header and upper layer data.

two。 Functions of the network layer

The IP address in the network layer packet is equivalent to our logical address, the global address, and our computer will be assigned an address around the world.

three。 Detailed explanation of packet format

Version: we now have two versions of IPV4,IPV6, first of all, our IP address resources are limited, we are temporarily in the middle of these two, more than 6 billion people around the world.

Header length: it is the length of our header format and does not contain upper data

Priority and type of service: decide what data to send first. For example, if we send a QQ message to someone while we are downloading something, the computer will first send your QQ message. If you don't have this priority, you can only send the message after you have finished downloading.

Total length: packet header format length + data length, why do we have the header length and total length, so that the computer knows the length of the data and can slice and transmit the data.

Let's take a look at the second layer, which is the fragmented message. Each segment of data transmission, such as five gigabytes of a game, cannot be transmitted in one packet, which requires multiple data packets.

Identifier: a symbol for each segment of the packet

Flag: are there any other segments to follow?

Segment offset: data reorganization at destination

TTL: life cycle, the lifetime of each packet passing through a router will be reduced by 1, otherwise a packet will exist forever.

Protocol number: a protocol that describes upper-level data

Header checksum: check for packet integrity

Source address: your own IP address

Destination address: IP address of the other party

Optional: you can enter the time of the packet, which will be longer according to the actual situation.

data

IV. The principle of ARP protocol

How can our computer know each other's MAC address, through ARP to achieve, we provide to the data link layer encapsulation

Let's understand that in order to provide the source MAC and destination address for the data link layer encapsulation, I don't know what the data link layer is. Please see my previous blog.

The first step is that our PC1 host sends data to PC2 to see if its cache has the MAC address of PC2.

Second, if not, our PC1 will send an ARP request message through broadcast mode.

In the third step, all hosts can receive ARP request messages. As soon as PC2 sees my IP address, it will reply to unicast immediately, and other hosts will discard it.

In the fourth step, our PC1 will save the MAC address of the PC2 to the cache, which can be used immediately next time.

Tags: Data address length message format network upper layer host header destination cache link transmission principle thing two priority global each other that is Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Xiaomi vpn Microsoft Shulou Technology