Data link layer (Layer
2 of OSI model) is responsible for transfer data between network nodes within
the same LAN or adjacent nodes in WAN.
Data link layer has
two sub layers:
-
MAC – media access control, control who is
allowed to access the media (ie. CSMA/CD & CSMA/CA) and provides physical
addressing
-
LLC – logical link control provides flow control
and multiplexing for the logical link
Frame forwarding is based on MAC addresses, MAC address
table contain MAC address, port and vlan. Switch learns MAC addresses of the
connected devices dynamically by listening to incoming frames.
Unknown unicast
flooding happens when switch receives frame with unknown destination MAC
address then forwards this frame to all ports except for the port that received
that frame.
Frames that contain destination broadcast or destination
multicast addresses are also flooded.
In Layer 2 we can
find devices such as switches and bridges. Switches separate collision domain
per port with each frame received on the switch port being checked for errors.
Depends on the features broadcast traffic can be limited and other types filtering
or forwarding can be possible.
As an example Layer 2 Cisco Catalyst switch will
maintain following tables:
-
L2 Forwarding Table - Content Addressable Memory
(CAM)
-
Ternary Content Addressable Memory (TCAM) which is
an extension on CAM and contains ACLs in a compiled form (security ACL and QoS
policy)
TCAM table has two components:
-Feature Manager (FM) – compiles ACL
into entries
- Switching Database Manager (SDM)
– configures or tunes TCAM
After CAM and TCAM lookups are
complete the frame is action accordingly.
Examples of Layer 2
protocols:
-
Spanning Tree Protocol
-
Virtual LANs –VLANs – IEEE 802.1q
-
Quality of Service – QoS control
-
Ethernet Ring
Protection Switching - ERPS
-
Point-to-Point Protocol – PPP
-
High-Level Data Link Control - HDLC
-
Link Layer Discovery Protocol - LLDP
-
Cisco Discovery Protocol - CDP
-
Frame Relay
-
Fibre Distributed Data Interface - FDDI
-
Unidirectional Link Detection – UDLD
-
IEEE 802.11 – Wireless LAN
Differences between
switches and bridges:
-bridges are software based, switches hardware-based (use
ASICs when making forwarding decisions)
-switches perform error checking
-switches have buffers for each link
-most bridges have only 2 or 4 ports
-switch has one broadcast domain per vlan
-bridge can run only one instance of spanning tree, switch
can have multiple spanning tree instances