In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
one。 Data link layer
The data link layer realizes the logical link between the adjacent nodes, and the protocol unit used is the data frame. When transferring data between two nodes, the data link layer assembles the IP Datagram handed over by the network layer into a frame and transmits the frame over the link between the two adjacent nodes.
Three basic issues of the data link layer:
1. Encapsulated into frames, 2. Transparent transmission, 3. Error detection
Let's talk about encapsulation into frames:
To encapsulate a frame is to add a head and a tail before and after a piece of data, so as to form a frame. The IP Datagram in the network layer becomes the data part of the frame when it is transmitted to the data link layer. The header and tail are added before and after the data part of the frame to form a complete frame.
two。 MAC layer of Ethernet
Hardware address of the 1.MAC layer
In a local area network, a hardware address is also known as a physical address or MAC address. The length is 48 bits, it is in the factory of the network card.
Time-solidified. Use the ifconfig command under LINUX to take a look, and the "HWaddr 00:15:F2:14:9E:3F" section is the hardware address. When the adapter is produced, the 6-byte MAC address is solidified in the adapter's ROM. So it's actually an adapter address or adapter identifier.
Format of 2.MAC Fram
The destination address and source address are MAC addresses. There are three values in the frame protocol type field, which correspond to IP, ARP (address resolution) and RARP (inverse address resolution). At the end of the frame is the CRC check code.
The data length in Ethernet frame specifies a minimum of 46 bytes and a maximum of 1500 bytes. The length of ARP and RARP packets is less than 46 bytes, so the bits should be filled later. The maximum value of 1500 is called the maximum transmission unit of Ethernet (MTU). Different network types have different MTU. If a packet is routed from Ethernet to the dial-up link and the packet length is longer than the MTU of the dial-up link, the packet needs to be fragmentation. "MTU:1500" is also included in the output of the ifconfig command under LINUX. Note that the concept of MTU is based on the maximum length of the payload in the frame, excluding the length of the beginning of the frame.
3.ARP Datagram format
In the network communication, the application program of the source host knows the IP address and port number of the destination host, but does not know the hardware address of the destination host, and the data packet is first received by the network card and then deals with the upper layer protocol. If the hardware address of the received data packet does not match that of the local machine, it is discarded directly. Therefore, the hardware address of the destination host must be obtained before communicating. The ARP protocol plays this role.
The source host sends an ARP request, asking "what is the hardware address of the host whose IP address is 192.168.0.1", and broadcasts the request to the local network segment (the hardware address at the beginning of the Ethernet frame is filled with FF:FF:FF:FF:FF:FF for broadcast). The destination host receives the broadcast ARP request and finds that the IP address matches the local machine, then sends an ARP reply packet to the source host. Fill in your hardware address in the answer packet.
Each host maintains an ARP cache table, which can be viewed with the arp-a command under LINUX. The table item in the cache table has an expiration time (usually 20 minutes). If a table item is not used again within 20 minutes, the table item will become invalid. Next time, an ARP request will be issued to obtain the hardware address of the destination host.
The ARP Datagram frame format is shown in the following figure:
Note that the source MAC address and the destination MAC address appear once in the Ethernet header and ARP request, which is redundant in the case where the link layer is Ethernet, but may be necessary if the link layer is another type of network. The hardware type refers to the link layer network type, 1 is Ethernet, the protocol type refers to the address type to be translated, 0x0800 is the IP address, the length of the last two addresses is 6 and 4 (bytes) for the Ethernet address and IP address, respectively, the op field 1 indicates the ARP request, and the op field 2 indicates the ARP reply.
Here is a specific example:
Host 1 sends an ARP request to host 2:
Host 2 replies to the host 1ARP:
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.