2.L2 Switch Principle

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

L2 Switch Principle

Foreword

⚫ 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.

Innovation • Simplicity • Experience


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.

Innovation • Simplicity • Experience


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

Collision Collision
Switch Switch
domain domain

Innovation • Simplicity • Experience


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.

Innovation • Simplicity • Experience


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.

Innovation • Simplicity • Experience


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
Source MAC : MAC_PC1 MAC Address Port
F0/1 F0/2
Destination MAC : ffff.ffff.ffff
F0/3 ca00.1340.0000 F0/1

PC 1: PC 2:
ca00.1340.0000 ca04.0b74.0000

PC 3:
1c1b.0dc6.303f

Innovation • Simplicity • Experience


Building a MAC Address Table

⚫ PC 2 and PC 3 respond to the data frame.


⚫ The switch associates the source MAC address in a received data frame with the port that receives the
data frame.

L2 switch
MAC
MAC Address
Address Table
Table
MAC
MAC Address
Address Port
Port
F0/1 F0/2
F0/3
ca00.1340.0000
ca00.1340.0000 F0/1
F0/1
ca04.0b74.0000 F0/2
1c1b.0dc6.303f F0/3
PC 1: PC 2:
ca00.1340.0000 ca04.0b74.0000

PC 3:
1c1b.0dc6.303f

Innovation • Simplicity • Experience


Maintenance of a MAC Address Table

⚫ Maintenance and aging of MAC addresses


➢ When a switch port is down, MAC addresses associated with the port will be cleared.
➢ If a PC does not send any packet within a period of time (the default aging time of MAC addresses is 5 minutes),
the switch automatically deletes the MAC address entry of the PC.

L2 switch
MAC Address Table
MAC Address Port
F0/1 F0/2
F0/3 ca00.1340.0000 F0/1
ca04.0b74.0000 F0/2
1c1b.0dc6.303f F0/3
PC 1: PC 2:
ca00.1340.0000 ca04.0b74.0000

PC 3:
1c1b.0dc6.303f

Innovation • Simplicity • Experience


Unicast Forwarding

⚫ PC 1 sends a unicast frame to PC 2.


⚫ The switch sends out the frame through the F0/2 port based on the destination MAC address in the
frame.
⚫ The switch does not forward the unicast frame through other ports.

L2 switch
MAC Address Table
Source MAC : MAC_PC1
Destination MAC : ca04.0b74.0000 MAC Address Port
F0/1 F0/2
F0/3 ca00.1340.0000 F0/1
ca04.0b74.0000 F0/2
1c1b.0dc6.303f F0/3
PC 1: PC 2:
ca00.1340.0000 ca04.0b74.0000

PC 3:
1c1b.0dc6.303f

Innovation • Simplicity • Experience


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
Source MAC : MAC_PC1 MAC Address Port
Destination MAC : ffff.ffff.ffff F0/1 F0/2
F0/3 ca00.1340.0000 F0/1
ca04.0b74.0000 F0/2
1c1b.0dc6.303f F0/3
PC 1: PC 2:
ca00.1340.0000 ca04.0b74.0000

PC 3:
1c1b.0dc6.303f

Innovation • Simplicity • Experience


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
L2
Hub switch
Broadcast
domain

PC A PC B PC C PC D

Innovation • Simplicity • Experience


Practice Questions

1. An L2 Ethernet switch generates a MAC address entry based on the ( ) in a data frame received by a
port.
A. Source MAC address
B. Destination MAC address A
C. Source IP address
D. Destination IP address

2. Once a MAC address entry is generated on a switch, it will not be cleared unless it is manually deleted.
( )
A. True
B
B. False

Innovation • Simplicity • Experience


Practice Questions

1. In the following topology, all hosts can communicate with each other. In this case, there are ____
3
broadcast domains and ____ 5 collision domains on the network.

L3 switch
Router

Hub L2 switch

PC A PC B PC C PC D

Innovation • Simplicity • Experience


Practice Questions

1. When the switch receives the following message, what action will it take?
 Receive message port: F0/1, S MAC: 0000.0000.FFFF, D MAC:0000.0000.0001, ( ) B
 Receive message port: F0/2, S MAC: 0000.0000.FFFF, D MAC:0000.0000.0001, ( ) C
 Receive message port: F0/1, S MAC: 0000.0000.FFFF, D MAC:0000.0000.0007, ( ) A
A. Flood
B. Discard
MAC Address Table
C. Forward
MAC Address Port
0000.0000.0001 F0/1
0000.0000.0002 F0/1
0000.0000.0003 F0/3
0000.0000.0004 F0/2

Innovation • Simplicity • Experience


Summary

⚫ Switches generate MAC address entries through learning and forward Ethernet frames.
⚫ Switches handle the frames in three ways: forwarding, flooding, and discarding.
⚫ An L2 switch can only isolate collision domains but cannot isolate broadcast domains. L3 ports of routers
or L3 switches belong to separate broadcast domains.

Innovation • Simplicity • Experience


Ruijie Technical Support Portal:
https://www.ruijienetworks.com/support

Online Technical Support (Rita):


Ruijie Online https://www.ruijienetworks.com/rita

Service Channel Community:


https://community.ruijienetworks.com

Facebook (Ruijie Tech Support):


https://www.facebook.com/ruijietac

YouTube (Ruijie Technical Support):


https://www.youtube.com/c/RuijieTechnicalSupport
THANKS

You might also like