Http://www.cnblogs.com/yhl1234/archive/2009/02/03/1192085.html
In traditional Ethernet, why are there limits on the minimum and maximum frames?
Ethernet (IEEE 802.3) frame format:
1. Forward code: 7 bytes 0x55, a string of 1 and 0 intervals, used for signal synchronization
2. Frame start delimiter: 1-byte 0xd5 (10101011), indicating the start of a frame
3. Da (destination MAC): 6 bytes
4. SA (source MAC): 6 bytes
5. Type/length: 2 bytes, 0 ~ 1500 reserved as the length field value, 1536 ~ 65535 reserved as the type field value (0x0600 ~ 0 xFFFF)
6. Data: 46 ~ 1500 bytes
7. Frame verification sequence (FCS): 4 bytes. The CRC is used to calculate the checksum obtained from the target Mac to the data domain.
Ethernet is a type of LAN that uses CSMA/CD as the MAC Algorithm. Methods To avoid CSMA/CD conflicts: Send after listening, send while listening, and resend after random delay. In the event of a conflict, each host must be able to detect it. The minimum sending gap and the minimum frame length are also required to avoid conflicts.
Consider the following situation: the host sends a very small frame, while the two conflicting hosts are far apart. B starts sending frames the moment before the frames sent by host a are transmitted to host B. In this way, when frame a reaches B, B detects a conflict and sends a conflict signal. If frame a has been sent before the conflicting signal of B is transmitted to a, then a cannot detect the conflict and mistakenly believes that the sent message is successful. Because there is a delay in signal propagation, it takes some time to detect conflicts. This is why there must be a minimum frame length limit.
According to the standard, when 10 Mbps Ethernet uses a repeater, the maximum connection length is 2500 meters and a maximum of four reconnections are allowed. Therefore, the minimum transmission time for a 10 Mbps Ethernet frame is 51.2 microseconds. The data that can be transmitted during this period is 512 bits, so this time is also called 512 bits. This time is defined as an Ethernet time slot or a time slot in conflict. 512-bit = 64-byte, which is the reason for the minimum 64-byte Ethernet frame.
512 bits is the time when the host captures the channel. If the 64-byte frames sent by a host do not conflict with each other, no conflict will occur in the future. This host captures the channel.
Because the channel is shared by all hosts, if the data frame is too long, some hosts cannot send data for a long time, and some send data may exceed the buffer size of the acceptor, resulting in buffer overflow. To prevent a single host from occupying too long a channel, the maximum frame length of an Ethernet frame is 1500.
When the time slot of 512 Mbps Ethernet is still 5.12 bits, the minimum sending time of a frame must be μs.
The time slot of 512 Mbps Ethernet is increased to 4096 bytes, that is, 4.096 μs for bits.
Familiar with the minimum frame length, you can understand why the CSMA/CD protocol-based Ethernet network segment length restrictions, but also master the essence of Ethernet.
Before that, we should first understand the CSMA/CD protocol.
What is the CSMA/CD Protocol (the carrier listens to multiple access channels/Conflict Detection Protocols )? There are a lot of people in a room. If they talk at the same time, no one knows what others are talking about. So we agreed on a mechanism: before talking, everyone listens to other people (the carrier listens). If there is one, they will not speak. If not, they will speak. If no one is talking in the room at the same time, you can open your mouth at the same time. In this case, a conflict (conflict detection) occurs. After a conflict occurs, everyone will shut up, everyone chooses a random time to speak, so that the person with the shortest random time can speak, while others listen. In this big room, everyone can talk to each other (multiple accesses) in the same space (sharing the same media. Instead of talking to someone ). Ethernet follows this mode of communication. Multiple devices connected to the same network must listen to other online machines before sending data. If no data is sent, if a conflict occurs, it will be sent at a random time.
The key point is: how do sending and receiving terminals perceive conflicts?
Assume that A and B are linked through a conveyor belt, and the rolling speed of the conveyor belt is C (c Represents the speed of light), that is, 20.3/NS (20.3 cm per nanosecond ), there is a guy named A1 at point A. He wants to divide an apple into a pile and send it to the person B1 at point B. Now what A1 needs to choose: when I transfer an apple to B1, if b1 also sends an apple to me, a conflict will occur, and the conflict will break down the transmitted apple, the broken Apple dregs will be sent back to me through the conveyor belt. I 'd like to know which small pile of apples have been broken. How can this problem be solved? One way is: when I receive the apple fragments, I am still spreading this pile of apples! For example, there are many piles of apples, 1st heaps, and 2nd heaps. When I send 3rd heaps of apples, I receive Apple fragments, it must have been a collision of the first apple in the 3rd heap, rather than an apple in the 2nd or 1st heap.
To achieve this, if the distance from A to B is 2500 meters (250000 cm), the apples on the conveyor belt are 20.3 cm kilometers per second, then, when the first Apple in a pile of apples reaches the B-point, the time is 250000 divided by 20.3 = 12500 nanoseconds, and the part return time is 12500 nanoseconds, which is equal to 25000 nanoseconds, this time is the time that a bunch of apples must last.
A person with better physical strength can put an apple on the conveyor belt quickly. A person with better physical strength can put Mbit apples on the conveyor belt per second, which means it takes 10 seconds to put an apple. Poor people can only put 10 Mbit on the conveyor every second, that is, put an apple for 100 nanoseconds.
Because a bunch of apples must last for 25000 nanoseconds, 25000 divided by 100 = 250 Apple for poor people, the result is the number of a bunch of apples. Therefore, in theory, the minimum frame length of a 10 Mbit/s Ethernet is bits. However, to ensure that the collision is detected, the minimum frame length is defined as 512bit (64 bytes ).
Because a bunch of apples have to last for 25000 nanoseconds. For physically good people, dividing 25000 by 10 = 2500 Apple, the result is the number of apples. Therefore, in theory, for an Ethernet of 100 Mbit/s, the minimum frame length should be bits. However, a-bit frame is too large, and the data packet from the upper layer cannot be so large. Therefore, we can only shorten the distance from A.M. To a.m., and the round-trip time of an apple on the conveyor belt is also 250 nanoseconds. At this time, divide 2500 by 10 = 250 Apple, and the result is the number of a bunch of apples. Therefore, in theory, for an Ethernet of 100 Mbit/s, the minimum frame length should be 250 bits, and the maximum valid network distance is meters. However, to ensure that the collision is detected, the minimum frame length is defined as 512bit (64 bytes ).
The following animation demonstrates that when sending a to transmit data to B, a collision occurs at the place where it is about to reach B, so the collision fragments are returned to, A knows that the data being transmitted conflicts.
It can be seen that the faster the MAC layer sends, the shorter the maximum effective distance between Ethernet and Ethernet. However, for 1000 Mbit/s gibit Ethernet, there are two options for the MAC layer: either retain CSMA/CD or use it. If the CSMA/CD protocol is retained, collision detection is required, which reduces the maximum valid transmission distance of the network to 25 meters. Of course, you can increase the frame level without shortening the network distance, just as we started to analyze 100 Mbit/s Ethernet, so that a frame can last for a long enough time. However, because there is not so much data in the upper layer, we need to fill in useless data on the MAC layer to meet this requirement.
Finally, we export the following proportional relationship:
Minimum frame length/transmission rate
Proportional
Maximum network transmission distance/light speed
The maximum transmission distance of a network is also called a conflict domain. The time (minimum frame length/transmission rate) used to transmit a minimum frame is proportional to the time when one bit of information passes through the conflict domain.