Skip to main content
All tracks
Computer Networks

Data Link Layer and LANs

The data link layer moves frames between devices on the same network segment.

MAC addresses​

A MAC address is a 48-bit hardware address (for example 3C:22:FB:1A:9B:00) used inside a LAN. IP addresses are for end-to-end routing; MAC addresses are for the next hop.

Devices​

DeviceLayerBehaviour
Hub1Repeats bits to all ports
Switch2Learns MAC addresses and forwards frames only to the right port
Bridge2Connects two LAN segments
Router3Forwards packets between networks using IP

A switch builds a MAC address table: when a frame arrives it records "source MAC is on port N", and floods the frame only if the destination is unknown.

ARP​

The Address Resolution Protocol maps an IP address to a MAC address on the local network.

Host A: "Who has 192.168.1.10? Tell 192.168.1.5" (broadcast)
Host B: "192.168.1.10 is at 3C:22:FB:1A:9B:00" (unicast reply)

Results are cached in the ARP table.

Error detection​

MethodNotes
Parity bitDetects odd numbers of bit errors
ChecksumSum of data words (used in IP/TCP/UDP)
CRCPolynomial division; strong burst-error detection; used in Ethernet
Hamming codeDetects and corrects single-bit errors

Medium access control​

  • CSMA/CD (classic wired Ethernet): listen, send, detect collision, back off.
  • CSMA/CA (Wi-Fi): avoid collisions with random back-off and optional RTS/CTS.

VLANs​

A VLAN logically splits one switch into several broadcast domains, improving security and reducing broadcast traffic.

Finished reading?

Mark it complete to track your progress across the docs.

Questions and discussion

Stuck on something here, or found a clearer way to explain it? Start a thread.

All discussions
  • Ask a question or share what helped
  • React to useful answers
  • Sign in with GitHub to post

Comments are stored in GitHub Discussions and shown here by giscus. PrepVerse never sees your GitHub password.