Professional Documents
Culture Documents
2-2-1. L2 Switch Principle
2-2-1. L2 Switch Principle
2-2-1. L2 Switch Principle
Ethernet switches are important devices for data link layer communication. So, it is necessary
to understand the working principle of Ethernet switches, including the workflow of L2
switches, and working principle of L2 switches.
· Background
Early network devices could only make single-point communication with each other.
In the same physical environment, different devices can connect to only one device.
In order to improve the transmission efficiency and simplify the network topology, a multi-
point communication mechanism is needed.
· Switched Ethernet
Modern switching networks are built using switches. Each port of the switches belongs to a
separate collision domain and works in full-duplex mode. Each host connected to a port of a
switch exclusively uses the bandwidth of the port.
Collision Collision
domain domain
Collision domain
Switch Switch
Collision Collision
domain domain
· Ethernet Switch
Each switch port supports the full-duplex or half-duplex mode and different rates.
Ethernet switches need to maintain an important table — MAC address table, and forward
data frames based on MAC addresses.
· Working Principle of L2 Switches
An L2 switch selectively forwards frames from a receiving port to the port connecting to the destination node based
on the MAC address.
• Learning record: The mappings between source MAC addresses and receiving ports are recorded to build a MAC address
table.
• Table lookup and forwarding: After receiving a data frame, a switch reads the destination MAC address in the data frame
and looks up the MAC address in the MAC address table.
Forwarding If the MAC address exists in the MAC address table, the
switch forwards the data frame based on the specified port.
Flooding If the MAC address does not exist in the MAC address table, the
switch sends out data frame from all ports other than the one that
receives the data frame.
Discarding If the destination MAC address of the data frame is the MAC address
mapped to the receiving port, the switch discards the data frame.
· Building a MAC Address Table
When a switch is just started, there is no entry in the MAC address table.
PC 1 sends a data frame. The switch associates the source MAC address in the data frame sent by PC 1 with the
receiving port.
The switch forwards the data frame of PC 1 through ports (other than the receiving port F0/1).
L2 switch
MAC Address Table
MAC Address Port
ca00.1340.0000 F0/1
Source MAC : MAC_PC1
Destination MAC :ffff.ffff.ffff F0/1 F0/2
F0/3
PC 1: PC 2:
ca00.1340.0000 ca04.0b74.0000
PC 3:
1c1b.0dc6.303f
· Building a MAC Address Table
L2 switch
MAC Address Table
MAC Address Port
ca00.1340.0000 F0/1
PC 1: PC 2:
ca00.1340.0000 ca04.0b74.0000
PC 3:
1c1b.0dc6.303f
· Maintenance of a MAC Address Table
L2 switch
MAC Address Table
MAC Address Port
ca00.1340.0000 F0/1
PC 1: PC 2:
ca00.1340.0000 ca04.0b74.0000
PC 3:
1c1b.0dc6.303f
· Unicast Forwarding
The switch does not forward the unicast frame through other ports.
L2 switch
MAC Address Table
MAC Address Port
ca00.1340.0000 F0/1
Source MAC : MAC_PC1
Destination MAC : ca04.0b74.0000 F0/1 F0/2 ca04.0b74.0000 F0/2
PC 1: PC 2:
ca00.1340.0000 ca04.0b74.0000
PC 3:
1c1b.0dc6.303f
· Flooding
If the destination MAC address of a data frame is a broadcast address, multicast address, or unknown unicast
address, the switch floods the data frame.
It sends out the data frame through all ports other than the port that receives the data frame.
L2 switch
MAC Address Table
MAC Address Port
ca00.1340.0000 F0/1
Source MAC : MAC_PC1
Destination MAC :ffff.ffff.ffff F0/1 F0/2 ca04.0b74.0000 F0/2
PC 1: PC 2:
ca00.1340.0000 ca04.0b74.0000
PC 3:
1c1b.0dc6.303f
· Broadcast Domain
Hosts connected to different ports of a switch belong to different collision domains. Hosts can send data at the same
time. However, the switch floods the received broadcast frames in the same broadcast domain.
L3 ports of routers or L3 switches are separate broadcast domains. Broadcast frames sent from hosts are terminated
on the L3 ports.
L3 switch
Broadcast Router
domain
Broadcast
domain
Hub L2 switch
Broadcast
domain
PC A PC B PC C PC D
Practice Questions
1. An L2 Ethernet switch generates a MAC address entry based on the ( ) in a data frame received by
a port.
A
C Source IP address
D Destination IP address
Practice Questions
2. Once a MAC address entry is generated on a switch, it will not be cleared unless it is manually
deleted. ( )
A True
B False
B
Practice Questions
3. When the switch receives the following message, what action will it take?
0000.0000.0001 F0/1
0000.0000.0003 F0/3
C Forward
0000.0000.0004 F0/2