The basic principle of transfer machine

Chapter 7: Basic Principles of Handover Machine

        Some standards need to be followed when transmitting data in the network. The Ethernet protocol defines the transmission standard of data frames on Ethernet. Understanding the Ethernet protocol is the basis for fully understanding the data link layer communication. The Ethernet switch is the main device to realize data link layer communication, and it is necessary to understand the working principle of the Ethernet switch. After studying this chapter, we should be able to:

  • The forwarding method of the switch
  • How the Switch Works

7.1 The forwarding mode of the switch

  1. cut-through forwarding

As shown in Figure 6-1, the switch starts the forwarding process as long as it sees the destination MAC address. The switch does not detect errors and directly forwards data frames. The advantage of cut-through forwarding is that it does not require storage, the delay is very small, and the switching is very fast. Cut-through forwarding The disadvantage is that because the content of the data packet is not saved by the Ethernet switch, it is impossible to check whether the transmitted data packet is wrong.

 

                                                                       Figure 6-1 Structure of data frame

  1. store and forward

Store-and-forward means that the switch starts the forwarding process after receiving the complete data frame. Its advantage is that it performs CRC checks, and the switch detects errors, and if it finds an error packet, it will discard it. Its disadvantage is that the processing time delay is large.

  1. Fragment isolation

After receiving the first 64 bytes of the data packet, the switch looks up the forwarding table according to the frame header information. This switching mode combines the advantages of cut-through and store-and-forward. Like straight-through forwarding, there is no need to wait for the complete data frame to be forwarded before forwarding. First, check whether the length of the data packet is 64 bytes (512bit). , if it is larger than 64 bytes, forward it. And, like store and forward, it can provide error detection, which can detect frame errors in the first 64 bytes and discard error frames. Its advantage is to avoid the forwarding of false packets, and its disadvantage is that it does not provide data verification

The switching mode of Huawei switches is store and forward by default.

7.2 Working principle of the switch

  1. The initial state of the switch

In the initial state, the switch does not know the MAC address of the connected host, so the MAC address table is empty. In this example, SWA is in the initial state, and there is no entry in the MAC address table before receiving the data frame sent by host A.

 

Figure 7-1 Initial state of the switch

  1. Learning based on source MAC address

As shown in Figure 7-2, when host A sends data to host C, it generally sends an ARP request first to obtain the MAC address of host C. The destination MAC address in this ARP request frame is the broadcast address, and the source MAC address is its own MAC address. address. After receiving the frame, the SWA will add the mapping relationship between the source MAC address and the receiving port to the MAC address table. By default, the aging time of MAC address entries learned by the switch is 300 seconds. If the data frame sent by host A is received again within the aging time, the aging time of the mapping between host A's MAC address and G0/0/1 stored in SWA will be refreshed. Afterwards, if the switch receives data frames with the destination MAC address 00-01-02-03-04-AA, they will be forwarded through the G0/0/1 port. It should be noted that the MAC address entries manually added by the administrator will not be aged and refreshed.

 

Figure 7-2 Learning phase

  1. Received is a broadcast frame or unknown unicast frame forwarded on all ports except the source port

     After SWA records the MAC address of host A in its own MAC table, it checks that the MAC address of the data frame is FF-FF-FF-FF-FF-FF, and it will forward all ports except the source port g0/0/1. So host B and host C will receive the data frame.

 

Figure 7-3 Switch forwarding data

  1. Forwarding based on destination MAC address

After host B and host C receive the data frame, they both check the data frame. Host B finds that the destination is not itself, so it will not reply the data frame. Host C will send an ARP response. The destination MAC address of the reply data frame is the MAC address of host A, and the source MAC address is the MAC address of host C. When the SWA receives a reply data frame, it will add the mapping relationship between the source MAC address of the frame and the interface to the MAC address table. If this mapping already exists in the MAC address table, it will be refreshed. Then SWA queries the MAC address table, finds the corresponding forwarding port according to the destination MAC address of the frame, and forwards the data frame from G0/0/1. Details are shown in Figure 7-4.

 

Figure 7-4 Host reply

7.3 The processing behavior of the switch to the data frame

The switch will forward every frame that enters its port through the transmission medium. The basic function of the switch is to forward data frames. There are three types of frame processing behaviors of the switch: Flooding, Forwarding, and Discarding.

  

 

  Figure 7-5 Switch forwarding behavior (Zhang Yong needs to make up, at least it is original)

7.3.1 Flooding

The switch forwards frames coming in from a certain port out through all other ports (note that "all other ports" refers to all ports except the port where the frame entered the switch).

As shown in Figure 7-8, host 1 wants to access host 2 and send a unicast data frame. After the switch receives the data frame from port g0/0/1, it finds that the corresponding entry cannot be found in the MAC address table, then will flood the data frame. Send it out from g0/0/2 and g0/0/3.

 

7.3.2 Forwarding

The switch forwards the frame coming in from one port through another port (note that "another port" cannot be the port where the frame enters the switch).

As shown in Figure 7-9, host 1 wants to access host 2 and sends a unicast data frame. After receiving it from g0/0/1, the switch finds the corresponding entry in the MAC address table and forwards the frame point-to-point. Data Frame. Send the data frame out from the g0/0/2 port.

 

7.3.3 Discarding

If the frame entering a certain port of the switch from the transmission medium is a unicast frame, the switch will check the destination MAC address of the frame in the MAC table. If the MAC address table is found, compare whether the corresponding port number of the MAC address in the MAC address table is the port number of the port where the frame enters the switch from the transmission medium. If yes, the switch will discard the frame.

As shown in Figure 7-9, host 1 wants to access host 2 and sends a unicast data frame. After receiving it, switch 1 will flood the data frame if the corresponding entry cannot be found in the MAC address table. After receiving the data frame, the switch 2 finds that the port corresponding to the destination MAC address is the port for receiving the data frame, and discards the data frame.

 

7.4 Exercises

  1. A Layer 2 Ethernet switch generates entries in the MAC address table according to the () of the Ethernet frame received by the port?

A. Destination MAC address B. Destination IP address C. Source IP address D. Source MAC address

Question answer: D

Analysis of test questions: Layer 2 Ethernet switches learn to generate entries in the MAC address table based on the source MAC address, and based on the destination MAC

For address forwarding, choose D for this question.

  1. When the switch receives a unicast data frame, it will look up the destination MAC address in the MAC table. Which of the following statements is wrong?

A. If the MAC address is found, and the port corresponding to the MAC address in the MAC address table is the port through which the frame enters the switch, the switch performs a discard operation. B. If the MAC address cannot be found, the switch performs a flooding operation.

C. If the MAC address is found, and the port corresponding to the MAC address in the MAC address table is not the port where the frame enters the switching machine, the switch performs the forwarding operation.

D. If the MAC address cannot be found, the switch performs a discard operation.

Question answer: D

Analysis of test questions: The switch will perform flooding operation after receiving broadcast frames and unknown unicast frames, option D is wrong; option ABC is correct, choose D for this question.

  1. A Layer 2 switch belongs to the data link layer device, which can identify the MAC address information in the data frame, forward data according to the MAC address, and record these MAC addresses and corresponding port information in its own MAC address table ( ) .

A. Right B. Wrong

Answer to the question: A

Analysis of test questions: This question examines the principle of switch forwarding. choose right.

  1. When the switch receives a unicast data frame, if the destination MAC of the data frame can be found in the MAC table, the data frame will be forwarded out from the port corresponding to the MAC. ( )

A. Right B. Wrong

Answer to the question: B

Analysis of test questions: According to the forwarding principle of the switch, look up the MAC address table and forward according to the table. If there is no entry in the table, it will be flooded. If the corresponding mac address entry is a black hole mac, it will be discarded. So this question is correct.

  1. [Single-choice question] Which of the following descriptions about Layer 2 Ethernet switches is incorrect?

A. Layer 2 Ethernet switches work at the data link layer

B. Can learn MAC address

C. It is necessary to make certain modifications to the layer 3 header of the forwarded message, and then forward it

D. Forward according to the layer 2 header information of the Ethernet frame

Guess you like

Origin blog.csdn.net/lwljh134/article/details/130155419