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
| Device | Layer | Behaviour |
|---|---|---|
| Hub | 1 | Repeats bits to all ports |
| Switch | 2 | Learns MAC addresses and forwards frames only to the right port |
| Bridge | 2 | Connects two LAN segments |
| Router | 3 | Forwards 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
| Method | Notes |
|---|---|
| Parity bit | Detects odd numbers of bit errors |
| Checksum | Sum of data words (used in IP/TCP/UDP) |
| CRC | Polynomial division; strong burst-error detection; used in Ethernet |
| Hamming code | Detects 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.
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.
- 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.