We know that switches are not as stupid as hubs. Every byte received on one port is transmitted to all other ports. The switch can learn the hosts connected to each of its ports through autonomous learning capabilities. Therefore, when the switch receives a mac frame, it knows the destination host to which the data packet is sent by looking at the destination address of the frame, and then sends the data packet to the destination host through another connection destination host port.
So how does the switch know the host connected to it? This is the intelligence of the switch. It uses its independent learning ability to store the information of each host in the switching table to understand each host.
Let’s use a simple example to illustrate how the switch performs autonomous learning. As shown in the figure, there are four hosts with MAC addresses ABCD, connected through interfaces 1, 2, 3, and 4 and switches.
First, when host A sends data to host B. When the switch receives data from host A, the switching table is empty at first, so it broadcasts this data to all ports except port 1. All hosts except Host B will drop the received packets. Except for the exception, record the information of host A into the exchange table. At this time, the exchange table is as follows
When host B sends data to host A, the switch looks up the exchange table and knows about host A. On its own port 1, send it directly to host A through port 1 without broadcasting. Then, the information of host B is also recorded. At this time, the exchange table is as follows
As long as hosts C and D also send data to other hosts, their information will also be Recorded to the switching table, so eventually the switch will know all hosts.
Think about this situation. If the host of switch interface 1 is replaced, wouldn't the switch's switching table contain wrong items? Therefore, the switching table has a survival time, and expired items will be automatically deleted to prevent the port from changing the host or the host changing the network card.
The above is the detailed content of The implementation process of switch autonomous learning - updating the switching table. For more information, please follow other related articles on the PHP Chinese website!