Definition – Layer-2 Switches
Layer 2 switches, also known as Ethernet switches, operate at the data link layer (Layer 2) of the OSI (Open Systems Interconnection) model. These switches use MAC (Media Access Control) addresses to forward data packets within a local area network (LAN). Layer 2 switches are fundamental networking devices that provide connectivity between devices within the same network segment, offering high-speed, low-latency communication.

Key Features and Characteristics of Layer-2 Switches
- MAC Address Learning:
- Layer 2 switches maintain a MAC address table, also known as a forwarding table or MAC address table, which maps MAC addresses to the corresponding switch ports.
- When a switch receives an Ethernet frame, it examines the source MAC address and updates its MAC address table with the port from which the frame was received.
- MAC Address Forwarding:
- Layer 2 switches use MAC address tables to forward Ethernet frames only to the port where the destination device is connected.
- If the destination MAC address is not found in the MAC address table, the switch floods the frame to all ports except the one on which it was received, allowing the destination device to respond and update the MAC address table.
- Switching Fabric:
- Layer 2 switches use a switching fabric, which consists of specialized hardware components and algorithms, to forward data packets between ports efficiently.
- The switching fabric allows for wire-speed packet switching, enabling high-performance communication between devices.
- Broadcast and Multicast Handling:
- Layer 2 switches forward broadcast frames to all ports except the port on which the frame was received, ensuring that broadcast traffic reaches all devices within the same LAN.
- Multicast frames are forwarded based on multicast MAC addresses, allowing multicast traffic to be selectively forwarded to specific ports.
- VLAN Support:
- Some Layer 2 switches support VLAN (Virtual Local Area Network) functionality, allowing them to segment a LAN into multiple virtual LANs.
- VLANs enable network administrators to logically separate devices into different broadcast domains, improving network performance, security, and manageability.
- Spanning Tree Protocol (STP):
- Layer 2 switches may support Spanning Tree Protocol (STP) or its variants (e.g., Rapid Spanning Tree Protocol, Multiple Spanning Tree Protocol) to prevent loops in the network topology.
- STP ensures that only one path is active between any two switches in the network, preventing broadcast storms and packet duplication.
- Link Aggregation:
- Layer 2 switches may support link aggregation, also known as port trunking or EtherChannel, which allows multiple physical links to be combined into a single logical link for increased bandwidth and redundancy.
Use Cases of Layer-2 Switches
- LAN Connectivity:
- Layer 2 switches provide connectivity for devices within the same LAN, including computers, printers, servers, IP phones, and IoT devices.
- Broadcast Domain Segmentation:
- VLAN support allows network administrators to segment a LAN into multiple broadcast domains, enhancing network performance, security, and manageability.
- Access Control and Security:
- Layer 2 switches can enforce access control policies based on MAC addresses, limiting access to specific ports or VLANs to authorized devices.
- Voice and Data Convergence:
- Layer 2 switches support the integration of voice and data traffic over the same network infrastructure, enabling the deployment of IP telephony systems.
Summary of Layer-2 Switches
A Layer-2 switch operates at the data link layer (Layer 2) of the OSI model and is responsible for forwarding data frames based on MAC addresses. Here are the key points:
- Switching Functionality: Layer-2 switches forward data within the same local area network (LAN) by using MAC addresses to determine the destination of each frame.
- MAC Address Table: They maintain a table of MAC addresses and their associated switch ports to efficiently direct traffic.
- Broadcast Domains: All ports on a Layer-2 switch belong to the same broadcast domain, meaning broadcasts are sent to all devices within the LAN.
- VLAN Support: Many Layer-2 switches support Virtual Local Area Networks (VLANs), allowing network segmentation at Layer 2 for improved management and security.
- Low Latency: These switches typically have low latency and are suitable for high-speed local network traffic.
Overall, Layer-2 switches are essential for connecting devices within the same LAN, providing efficient and low-latency data forwarding based on MAC addresses. They are widely used in small to medium-sized networks and as access switches in larger networks.
Useful links
https://sanchitgurukul.com/switch
https://www.cisco.com/c/en/us/support/switches/350x-series-stackable-managed-switches/series.html
