TCP/IP supports a variety of link layer protocols, depending on the hardware used by the network, such as Ethernet, ring-based network, FDDI (Fiber Distributed Data interface, and fiber distributed data interface. The network based on different hardware uses different frames. Ethernet is the most widely used LAN technology today.
Frame Structure of Ethernet V2.0:
Forward guide code |
Pre-frame delimiters |
Destination Address da |
Source Address SA |
Type field |
Data Field |
Frame verification field |
7b |
1B |
6b |
6b |
2b |
46 ~ 1500b |
4b |
1. Fields of the forward guide code and pre-frame delimiters
A forward code consists of a 56-bit (7b) 101010-bit 1010-bit sequence, which consists of eight bytes and a 10101011-bit sequence.
If the forward code is viewed with the delimiters before the frame, 11 occurs after the 62-bit 101010... 1010 bits. After this 11 is the destination address field of the Ethernet frame. From the perspective of Ethernet physical layer, it takes some time for the receiving circuit to receive bits to enter a stable State. The purpose of designing the first 62-bit 1 and 0 alternate bit sequences is to ensure that the receiving circuit is in normal state before the target address of the frame arrives. When the receiving end receives the last two 11 digits, it indicates that the destination address of the frame is after the receiver. The forward code and the delimiters before the frame mainly play the role of receiving and synchronizing. These 8 bytes do not need to be retained after receiving, nor are they included in the length of the frame header.
2. Destination Address and Source Address
The destination address and source address represent the hardware addresses of the receiving node and the sending node respectively. A hardware address is generally called a MAC address, a physical address, or an ethernet address. The address length is 6B (48 digits ). For convenience, it is usually written in hexadecimal numbers.
The destination address of an Ethernet frame can be divided into three types:
Unicast address: the first address of the target address is 0, indicating the unicast address. If the destination address is a unicast address, it indicates that the frame is received only by nodes with the same destination address.
Multicast address: the first entry of the destination address is 1, indicating the multicast address. If the destination address is a multicast address, the frame is received by a group of nodes.
Broadcast address: The target address is 1, indicating the broadcast address. If the destination address is a broadcast address, the frame is received by all nodes.
3. Type field
The Type field indicates the protocol type used by the network layer. Common protocol types: 0800 indicates that the network layer uses the IP protocol, 0806 indicates that the network layer uses the ARP protocol, 8137 indicates that the network layer uses the Novell IPX protocol, and 809b indicates that the network layer uses the Apple Talk Protocol.
4. data fields
The IEEE 802.3 protocol specifies that the data length ranges from 46 ~ Between 1500b. If the data length is less than 46b, you need to add the padding byte to supplement 46b. The padding byte is arbitrary and is not included in the length field. The length of the frame header is 18B, including the destination address field of 6B, source address field of 6B, type field of 2B, and frame verification field of 4b, the forward code and the pre-frame delimiters are not included in the frame header length. Therefore, the minimum length of an ehternet frame is 64b (46b + 18B) and the maximum length is 1518b (1500b + 18B ). One purpose of setting the minimum frame length is to enable each receiving node to have enough time to detect conflicts.
5. Frame verification Fields
The frame verification field FCS adopts CRC verification. The verification scope includes the target address field, source address field, type field, and data field. Check at the receiving end. If an error occurs, the frame will be discarded.
The 32-bit CRC verification generates a polynomial:
G (x) = x32 + X26 + x23 + x22 + x16 + X12 + X11 + x10 + X8 + X7 + X5 + X4 + X2 + X1 + 1