Skip to main content
NETWORKING · SWITCHING

What Is a Layer 2 Switch?

A Layer 2 switch forwards Ethernet frames between devices using their MAC addresses, which belong to the data link layer (Layer 2) of the OSI model. It learns which device is on which port and sends each frame only where it needs to go. It connects devices within one network or VLAN; routing between networks needs Layer 3.

01

How a Layer 2 switch works

A Layer 2 switch is a network switch that makes its forwarding decisions on Layer 2 information: the source and destination MAC addresses in each Ethernet frame. Layer 2 is the data link layer of the seven-layer OSI model. The switch does not look at IP addresses, so to it the network is a set of hardware addresses on ports.

The switch builds its knowledge as traffic flows. When a frame arrives, it records the sender’s MAC address against the incoming port in its MAC address table. To forward the frame, it looks up the destination address. If the address is known, the frame goes out of that one port; if it is not, or the frame is a broadcast, the switch floods it out of every port in the same VLAN. Entries that stop being used age out, after 300 seconds by default, so the table keeps up with devices that move.

That targeted forwarding is what separates a switch from a hub, which repeats everything to every port. Each switch port is its own collision domain, links run full duplex, and devices that are not part of a conversation never have to process it.

FAQ · 01
What is the difference between a hub and a switch?
A hub repeats every frame to every port, while a switch forwards by MAC address. Our FAQ compares the two and explains why hubs have all but disappeared.
Read the full FAQ —
02

Store-and-forward and cut-through

Most Layer 2 switches use store-and-forward. They receive the whole frame, check its frame check sequence, drop it if it is corrupted and only then send it on. Cut-through switches start forwarding as soon as they have read the destination address, which saves up to around 12 µs for a full-length frame at gigabit speed but passes damaged frames along. Industrial switches are mostly store-and-forward, and the difference rarely matters outside specialist low-latency work.

03

Layer 2 features and the standards behind them

A switch that only learns and forwards is the simplest kind, and it is what an unmanaged switch is. Managed Layer 2 switches add features defined in IEEE and IETF standards, which is where most of their value lies on an industrial network.

Feature Standard What it does Industrial use
MAC learning and forwarding IEEE 802.1Q (bridging) Sends each frame only to the port where its destination is The basis of every switched network
VLANs IEEE 802.1Q Splits one switch into separate broadcast domains Separating control, camera and office traffic
Rapid spanning tree (RSTP) IEEE 802.1w, now part of 802.1Q Blocks loops while keeping backup links ready Redundant links between cabinets
Link aggregation (LACP) IEEE 802.1AX Bundles ports into one faster, resilient link Uplinks from a cell to the plant core
Priority tagging (QoS) IEEE 802.1p, part of 802.1Q Marks frames so urgent traffic goes first Control traffic ahead of bulk video
Port authentication IEEE 802.1X Keeps a port closed until the device authenticates Stopping unknown laptops joining the control network
Multicast filtering IGMP snooping (RFC 4541) Sends multicast only to ports that asked for it EtherNet/IP I/O and video streams
Ring redundancy ITU-T G.8032 (ERPS) and vendor rings Recovers a switch ring in under 50 ms Switch rings along lines, tunnels and track
04

Why a Layer 2 switch has an IP address

A common point of confusion: if a Layer 2 switch forwards by MAC address, why does a managed one need an IP address? The answer is management. The address belongs to the switch’s own management interface, so engineers can reach its web page, SSH console or SNMP agent, and so the switch can send alarms, set its clock and download firmware. It never uses that address to forward anyone else’s traffic.

Some switches are described as Layer 2+ or “Layer 3 lite”. They stay mainly Layer 2 but add a few IP functions, typically static routes between VLANs, without the dynamic routing protocols of a full Layer 3 switch.

05

Where Layer 2 ends

A Layer 2 switch keeps traffic within one network. Devices in different VLANs or IP subnets cannot talk through it alone; something has to route between them, either a router or a Layer 3 switch. Our white paper on Layer 2 vs Layer 3 switches covers that step, including inter-VLAN routing and when an edge network needs it. Size matters too. Every broadcast reaches every device in a Layer 2 domain, and a cabling loop without spanning tree can turn that into a broadcast storm that stops the network. Splitting a large flat network into VLANs, and routing between them, keeps each domain small enough to stay predictable.

For most machines, cells and cabinets, Layer 2 is enough. Our white paper on types of Ethernet switches sets out the industrial, rugged and military forms that Layer 2 switching comes in. In our range, the unmanaged industrial switches are plug-and-play Layer 2 switches, most of our managed industrial switches are listed as Layer 2 managed switches with VLAN and RSTP support, and Layer 2 Ethernet switch boards bring the same switching inside an embedded system. Our explainer on VLANs covers the most used Layer 2 feature in more detail.

06

Quick answers on Layer 2 switches

Layer 2 switches: common questions

What is the difference between a Layer 2 and a Layer 3 switch?

Routing. A Layer 2 switch forwards by MAC address within a network. A Layer 3 switch also routes between VLANs and subnets by IP address.

Is an unmanaged switch a Layer 2 switch?

Yes. It learns MAC addresses and forwards frames, but has none of the configurable features such as VLANs.

Can a Layer 2 switch do VLANs?

Yes, if it is managed. VLANs are a Layer 2 feature of IEEE 802.1Q, but routing between them needs Layer 3.

Does a Layer 2 switch need an IP address?

Only for management. Forwarding uses MAC addresses. The IP address lets you configure and monitor the switch.

Is a Layer 2 switch faster than a Layer 3 switch?

Not noticeably. Modern Layer 3 switches route in hardware at line rate, so the choice comes down to features, not speed.

We supply Layer 2 and Layer 3 industrial switches as part of complete systems, and as standard we can set up the VLANs, redundancy and management addresses before the system ships.