Networking Tutorials

Layer 2 vs Layer 3: Switching vs Routing

The core distinction in networking: Layer 2 forwards frames within a network using MAC addresses (switching), while Layer 3 forwards packets between networks using IP addresses (routing). Nearly every device and protocol lives at one of these two layers.

Side by side

FactorLayer 2Layer 3
AddressesMAC addressesIP addresses
ScopeWithin one networkBetween networks
DeviceSwitchRouter / L3 switch
Forwarding byFrame → destination MACPacket → destination IP
Broadcast domainsOne (per VLAN)Separated

The details that matter

Layer 2 is the local delivery layer — a switch reads destination MAC addresses and forwards frames to the right port within the same network. Layer 3 is the inter-network layer — a router reads destination IP addresses and forwards packets between different networks, choosing paths and separating broadcast domains. A packet keeps the same source/destination IP end to end (Layer 3), but its MAC addresses change at every hop (Layer 2). A Layer 3 switch does both — switching within VLANs and routing between them. This split is the backbone of the OSI model and a constant interview theme.

Frequently asked questions

What is the difference between Layer 2 and Layer 3?

Layer 2 forwards frames within a network using MAC addresses (switching); Layer 3 forwards packets between networks using IP addresses (routing) and separates broadcast domains.

Is a switch Layer 2 or Layer 3?

A standard switch is Layer 2; a multilayer (Layer 3) switch also routes between VLANs using IP addresses at hardware speed.

Do MAC and IP addresses both change as a packet travels?

The IP addresses stay the same end to end (Layer 3); the MAC addresses change at each hop (Layer 2) as the packet is re-framed for the next link.

VS
Vipul Sir — Lead Instructor, Attila Technologies20+ years in Cisco networking. Teaching CCNA, CCNP, CCIE & CyberOps in Ahmedabad since 2004.

Want hands-on training?

Learn this on real Cisco lab devices with placement support at Attila Technologies, Ahmedabad.

Start your networking career with Attila Technologies

Hands-on Cisco training, real lab devices and placement support in Ahmedabad.