NetwNETW
Curriculum
CHAPTER 04

Data Link Layer

Frames, MAC addresses, switches, ARP, VLANs

14 min read7 sections
In this chapter
FramesMAC addressesSwitchesSwitch forwarding demoARPVLANsSpanning Tree (STP)

01Frames

L2 wraps packets into frames with source/destination MAC addresses and a CRC (FCS) for error detection. A frame exists only on one link; it is rebuilt at each hop.

02MAC addresses

48-bit hardware identifiers, globally unique (OUI + device). Used only on the local segment. First 3 bytes = OUI (vendor), last 3 = device serial.

What is a MAC address?

A MAC address is the name a device uses on its local network. Click next to learn its parts.

Loading the 3D MAC diagram…
A MAC address is a 6-byte number burned into every network card at the factory. It is the device's name on the local network.

03Switches

Learn MAC→port mappings from source addresses, then forward frames only to the right port (unicast) or flood (unknown/broadcast). VLANs segment broadcast domains on the same physical switch.

How a switch really works

Watch the MAC table build itself. Pick a source and a destination, then send a frame.

Loading the switch scene…
MAC address table
PortMACDevice
1—PC 1
2—PC 2
3—PC 3
4—PC 4
Pick two PCs and send a frame. The switch starts with an empty table.

A switch reads the source MAC of every incoming frame and remembers which port it arrived on. That is MAC learning.

If the destination MAC is known, the frame goes only to that port. If it is unknown, the switch floods it to every port except the one it arrived on.

A hub does none of this. It sends every frame to every port, which wastes bandwidth and creates one big collision domain.

04Switch forwarding demo

Watch the MAC table build as frames flow. Unknown destinations are flooded; known ones are forwarded precisely.

What a switch actually does

A switch is a box with many ports. It learns which device is on which port, then sends each frame only where it needs to go.

to
Switch MAC table
MACPort
empty
Press Send. The switch starts with an empty table.
learn
remember source port
lookup
find destination port
forward
one port, or flood

05ARP

Address Resolution Protocol maps an IP address to a MAC address on the local network. ARP requests are broadcast; replies are unicast. ARP cache entries expire (typically 20 min).

ARP Resolution

  1. 1Host A knows IP 10.0.0.5 but not its MAC. Broadcasts ARP request: 'who has 10.0.0.5?'
  2. 2Switch floods the request to all ports.
  3. 3Host B (10.0.0.5) replies unicast: 'I am aa:bb:cc:00:02'.
  4. 4Host A caches IP→MAC mapping (ARP cache, TTL).

06VLANs

Virtual LANs split one switch into multiple broadcast domains using 802.1Q tags (4-byte tag with VLAN ID). Trunk ports carry multiple VLANs; access ports belong to one.

07Spanning Tree (STP)

Prevents Layer-2 loops in redundant topologies by blocking ports. RSTP/PVST+ converge faster. Without STP, a loop floods broadcast storms and melts the network.

Check your understanding
0 / 1 correct
A switch forwards based on which address?