Ethernet, the basic of computer network

ethernet

As the most important technology of LAN, Ethernet is originally based on the simplest bus topology.

initial stage

  • XEROX PARC from the early 1970s

  • First-generation Ethernet can connect up to 256 computers using cables up to 1000 meters long and with a bandwidth of 2.94Mbps
  • IEEE approves 10 Mbps Ethernet specification proposed by Xerox-Digital-Intel Alliance

basic components

  • Ethernet Cable – Physical Media
  • CSMA/CD – Framework for Concurrent Access and Collision Control on Transmission Media
  • Data is sent in the form of Ethernet packets, which is what we usually call "frames"

1. Basic principles

Packets of data travel over a bus known as "Ethernet," and each packet is sent to all incoming computers, but only the destination computer for further processing.

insert image description here
Ethernet is a shared medium LAN technology. Multiple sites are connected to a shared medium, and only one site can send data at a time. There must be a conflict problem in this shared medium communication method. How to detect whether the link is Idle, whether the station can send data is a problem that must be solved for the shared link.

This same link connects multiple terminals, that is, multiple access . There are many protocols for multi-channel access control, such as random access control protocol, controlled access control protocol, and channelization protocol.
insert image description here

  • Random access control protocol
    In the random access control protocol, all terminals connected to the shared medium have an equal probability of sending data.
  • Controlled Access Control Protocol
    Controlled Access Control Protocol is a polling mechanism that controls which station sends data through polling.
  • Channelization protocol
    Channelization protocol is a multiplexing technology, which will be introduced in detail in the future combined with the development of mobile communication.

2. Multiple access algorithm (CSMA/CD)

Ethernet adopts CSMA/CD Carrier Sense Multiple Access / Collision Detection Carrier Sense Multiple Access / Collision Detection, the most multiple access control protocol.

To put it simply, we can compare CSMA/CD to a conversation, in which everyone has the right to speak, but only one person can speak at the same time, otherwise confusion will occur.

Before everyone speaks, they must first listen to whether someone else is speaking ( that is, carrier detection ). If someone else is speaking at this time, they can only wait patiently and wait for the other person to finish speaking before he can express his opinion.

In addition, if two people want to talk at the same time, then there will be a conflict at this time. When two people speak at the same time, both will find that they are speaking at the same time ( i.e. collision detection ).

At this time, speaking stops immediately, waits for a random period of time (backoff), and then starts speaking. At this time, the first person starts to speak, and the second person must wait until the first person has finished speaking before he can start speaking.

The following figure is the flow chart of a station sending data frames. When a station data frame is about to be sent, it starts to detect whether the physical medium is idle. This process is called carrier sense. If the medium is busy at this time, you can only wait patiently and postpone the sending of the data frame.
insert image description here
If the medium is found to be idle during the carrier sense process, it is necessary to wait for the IFG (Inter Frame Gap) time to restore the physical channel to stability, and at the same time allow the receiver to perform necessary processing on the received frame. Start sending data frames after waiting for IFG time. If there is no other station to send data at this time, no conflict will occur, and the station can completely send the data frame, repeat the next sending process, and continue to send the next data frame.

If multiple stations want to send data at the same time, a collision will occur. After the collision occurs, the sending station will continue to send jamming signals for a period of time. The purpose of sending jamming signals is to ensure that all stations on the shared medium are It can be detected that a collision has occurred on the Ethernet at this time. Then the sending station terminates the transmission of the unsent data frames, and waits for a random time, which is backing off, and the waiting random time is called backing off time.

The fallback time is an integer multiple
of Slotime (SlotTime is the time required to transmit the shortest Ethernet frame, for 10M and 100M, the time required to transmit 512bit, 10M is 51.2 microseconds, 100M is 5.12 microseconds), thereturn The value range of the back-off time is related to the number of conflicts detected. After each conflict is detected, r selects a random integer from 0 to 2k 0<r<2k, where k=MIN {n, 10}, n is the detection to the number of conflicts. The fallback time is r * SlotTime.

For example, after starting to transmit data frames, you need to wait for 0-1 times SlotTime after detecting a conflict for the first time, wait for a random integer number of SIotime in 0-3 after detecting a conflict for the second time, and so on.

When the number of detected collisions exceeds the maximum number of retries (usually 16), it means that the data frame has failed to be sent, stop sending the data frame, notify the network administrator of a pin error and discard the data frame, or simply discard the data frame, then reset the backoff time to 0, start collision detection and prepare to send the next data frame.

3. How to calculate the collision detection?

Assume that stations A and B at both ends of the LAN are 1km apart and connected with coaxial cables. The propagation delay of electromagnetic wave in 1km cable is 5μs. Therefore, the data sent by A to B can only be transmitted to B after about 5 μs. In other words, if B sends its own frame before the data sent by A arrives (because B's carrier sense cannot detect the information sent by A at this time), it must collide with the frame sent by A at a certain time. The result of the collision is that both frames become useless.

In the analysis of LAN, the one-way end-to-end propagation delay on the bus is often recorded as τ. So how long will it take at the latest after A sends the data to know whether the data sent by itself has collided with the data sent by other stations?
insert image description here
The above diagram is explained below.
1. At t=0, A sends data, and B detects that the channel is idle.
2. When t=τ-δ (τ>δ>0), when the data sent by A has not reached B, because B detects that the channel is idle, B starts to send data.
3. After time δ/2, that is, at t=τ-δ/2, the data sent by A collides with the data sent by B. However, neither A nor B knows.
4. When t=τ, that is, the data sent by A reaches B, B detects a collision, and stops sending data.
5. At t=2τ-δ, A also detects that a collision has occurred (the data sent by B reaches A), and stops sending data.

It can be seen that each station has the possibility of encountering a collision within a short period of time after it sends data. Therefore, when δ–>0, this time is the maximum value. Therefore, the Ethernet end-to-end round-trip time is called the contention period. The contention period is also called the collision window, and no collision will occur during this period to ensure that the sending will not collide.

Ethernet uses a truncated binary exponential backoff algorithm to solve the collision problem. That is, the fallback time part mentioned in the second part. Ethernet sets the contention period as 51.2 μs, that is, 512 bits can be sent, that is, 64 bytes. That means that when the Ethernet sends data, if the first 64 bytes of the frame do not collide, then the subsequent data will not collide.
In other words, if there is a collision, it must be within the first 64 bytes sent. Therefore, the Ethernet stipulates that the shortest effective frame length is 64 bytes, and any frame with a length less than 64 bytes is an invalid frame terminated abnormally due to a collision, and such a frame should be discarded immediately upon receipt.

Guess you like

Origin blog.csdn.net/koudan567/article/details/98504192
Recommended