Linux LAN Driver Learning (eight) (forwarding data based on MAC address)

Source: Internet
Author: User

1. Build MAC Address Table

Switch technology must know the MAC address of the host to which each port is connected before forwarding the data, and build a MAC address table. When the switch receives a data frame from a port, it reads the destination MAC address information encapsulated in the data frame, and then goes through the pre-built MAC Address table to find the port corresponding to the destination address, forwards the data from that port, and the other ports are not affected, thus avoiding collisions with data on other ports. Therefore, building the MAC Address Table is the primary task of the switch. The following is an example of how the switch establishes the Address table.

"Analysis" assumes that host a sends a data frame to host C (each data frame contains both the source MAC address and the destination MAC address), and when the data frame enters the switch from the E0 port, the switch checks the source MAC address field in the data frame, Put the value of the field (the MAC address of host a) into the MAC address table and correspond it to the E0 port, indicating that the host connected to the E0 port is a (11-5). At this point, because there is no entry in the MAC Address table about the destination MAC address (the MAC address of host C). Switch technology forwards this frame to all ports except the E0 port, ensuring that host C receives the frame (this operation is called flooding).

2. The switch forwards the data according to the Address table

Similarly, when the switch receives the data of Host B, C, D, it also learns the address, writes it to the Address table, and corresponds to the corresponding port and MAC address. Eventually, all the host addresses will be learned to build a complete table of addresses. At this point, if host a then sends a data frame to host C, the application switch technology will only forward this data frame from its E2 port according to the address correspondence in its MAC address table. This allows host C to receive only the data frames that host a sends to it, no longer affecting the other ports. It is also possible to communicate between host A and host C while other hosts (such as Host B and host D) are communicating.

When the switch establishes the complete MAC address table, the data frame is forwarded by looking up the MAC address table to get the corresponding port, thus sending the data frame through a specific port. However, for broadcast data that enters from a port and no address entry is found in the Address table, the switch forwards the data frame from all ports except the access port. From this perspective, the devices connected by the switches are in the same broadcast domain, but they are in a different collision domain.

Here to explain how the switch establishes the MAC address table, suppose a sends a data frame to C. This is not the case, and it is not necessary for a communication switch between hosts to learn the MAC address. In fact, the switch learns the MAC address of the host when the NIC driver is loaded.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Linux LAN Driver Learning (eight) (forwarding data based on MAC address)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.