Layer switch forwards data parsing principle
First, what is the switcher
Switcher operates in Layer 2 (data link layer) of the OSI model, therefore called switcher. Layer development of switching technology is relatively mature, switcher device belongs to the data link layer, a MAC address may be information for identifying data frames are forwarded based on MAC addresses and ports inside own MAC address corresponding to the record an address table.
Second, the characteristics of the switch
1, learning
Know each Ethernet switch port MAC address of the connected device, and the address is stored in the switch buffer in the MAC address table with the port mapping them.
2, forwarding / filtering
When the destination address of the packet has a MAC address mapping table, which is forwarded to the destination node connected to ports instead of all ports (e.g., the data frame is a broadcast / multicast frames are forwarded to all ports).
Third, the data forwarding process switcher
As shown in FIG.
1, Introduction environment:
(1) switches to the initial state, if the MAC address of the host to know each other ABC
(2) Host A wants to communicate with host B
2, the process of introduction
ABC know each other when the host MAC address
Host A sends a frame to the switch port number 1 of the data, then:
A source MAC address is the MAC Host
The destination MAC is the MAC host B
The switch receives the data frame A will first record the host's MAC address (MAC address recorded in the table) and the port number of the received frame, because the switch
MAC address table is not the destination MAC address, switch port will broadcast a port number 2 and 3, when the host B receives this and since
Have the corresponding broadcast will respond when send data frames to the switch, at this time:
MAC is the MAC source host B
A goal of the host MAC MAC
The switch records the MAC address of host B to accept the address and port number, and then searches the MAC unicast address table correspond directly to a host A
If the host does not know each other ABC MAC address
Arp host A sends a request to the switch, the switch records the MAC address of host A (referred to in the MAC address table) and the port number, and then 2
Port number and port number 3 arp broadcast, after host B receives the broadcast will respond to send a data frame to the switch, the switch will record the host B
MAC address and receiving port number of the address, and then query the MAC address table Unicast communicate directly with the host A.