ID
6
Chapter 6: Link Layer (LANs)
🔹 1. Link Layer (LANs): Overview & Goals
✅ What Is the Link Layer (LANs)?
- Responsible for transferring datagrams between adjacent nodes
- Includes:
- Error detection and correction
- Broadcast medium sharing
- Address resolution (e.g., ARP)
- Ethernet, switches, VLANs
- Key to understanding LANs, wireless, and datacenter networks
✅ Main Goal: Framing, Addressing, Multiple Access, Switching, VLANs, MPLS
🔹 2. Key Link Layer Functions
✅ Error Detection & Correction
Protocol | Function |
CRC (Cyclic Redundancy Check) | Detects and corrects errors |
Hamming Code | Detects and corrects single bit errors |
Parity | Detects single bit errors |
UDP/Transport Layer | Can provide reliability (e.g., TCP) if needed |
✅ Multiple Access (MAC) Protocols
Type | Description |
Channel Partitioning | Divides channel into entities (e.g., TDMA, FDMA) |
Random Access (e.g., ALOHA) | Uses collision detection (CD), collision avoidance (CA) |
Taking Turns | Polling, Token Passing |
🧠 Random access vs channel partitioning – different trade-offs
✅ Switches, VLANs, and MPLS
- Switches: Mac addresses, flooding, learning, forwarding
- VLANs: Virtual LAN, port-based or MAC-based, traffic isolation
- MPLS: Label-switching, fast forwarding, Cisco, Juniper, Google B4
📌 Packet forwarding on switches is crucial for link-layer efficiency and LAN performance
🔹 3. Basic Link Layer Services
✅ Link Layer Responsibilities
- Encapsulates IP datagram into Ethernet frame
- Adds error detection (CRC)
- Performs MAC (Media Access Control): decide when to transmit
- Maintains a forwarding table (based on MAC address)
✅ Link Layer Addressing
Address Type | Description |
MAC Address | 48-bit Ethernet address, static, global, burned-in |
IP Address | 32-bit or 128-bit, process-based, multicast, universe-wide |
Port number | Viewed from Transport perspective |
VLAN ID | Up to 12 bits, dynamic association with MAC address |
🔹 4. MAC (Media Access Control) Protocols
✅ Four Main Classes of MAC Protocols
Class | Description |
Channel Partitioning | Divide channel, allocate segments. e.g., TDMA, FDMA |
Random Access | Nodes transmit at full channel rate, handle collisions. e.g., ALOHA, CSMA/C |
Taking Turns | Nodes take turns to transmit. e.g., Polling, Token Passing |
Hybrid | Combination – e.g., CSMA/CA, contention slots |
💡 CSMA/CD is used in wired LANs, CSMA/CA is used in wireless LANs (e.g., Wi-Fi)
✅ Efficiency Trade-offs
- TDMA, FDMA: very efficient at high load, but inefficient at low
- Random access: good at low load, but more collisions at high
- Polling, Token Passing: synchronized, structured, no collisions, but latency may be worse
🔹 5. Ethernet: The Most Important LAN Tech
✅ Ethernet Key Features
Feature | Description |
Frame Format | 6 bytes: MAC addresses, data + CRC |
Speed | 10 Mbps to 100 Gbps, Ethernet standards |
Broadcast Channel | Shared wire, collisions |
Switches | Store-and-forward, MAC learning, VLAN support |
✅ Ethernet Frame Format
Field | Description |
Destination MAC Address | 6 bytes, e.g.: 58-23-D7-FA-20-B0 |
Source MAC Address | 6 bytes |
Type | Indicates upper layer protocol (e.g., 0x0800 for IP, 0x0806 for ARP) |
Data | Up to 1500 bytes |
CRC | Error detection, 4 bytes |
💡 Important Rule: Maximum frame size (MTU) is usually 1500 bytes – important for IP fragmentation.
🔹 6. Switches and Link Layer Forwarding
✅ Switch Key Functions
- MAC learning (builds forwarding table)
- Frame forwarding: only sends to the correct port
- No IP layer involvement, only Ethernet headers
- Operates in layer 2 (since it's not related to IP)
✅ Switch vs Router:
- Switch operates at MAC layer, not IP
- Router operates from application to link layer
✅ Switch Forwarding Table
- Mac Address: domain, target
- Interface: depends on MAC address
- TTL: holds entries for, say, 20 minutes
- Entry is persistent until changed or replaced
💡 Switching is fast, almost no delay, low overhead compared to routers.
🔹 7. Virtual LANs (VLANs): Centralized Network Management
✅ VLAN Purpose
- Isolate traffic (ARP, broadcast) between segments
- Security and management (prevent same VLAN abuse)
- Port-based, MAC-based: flexible options
- Span multiple switches using trunk ports and 802.1Q
✅ VLAN Frame Format
Field | Description |
802.1Q Tag | 2 bytes, includes VLAN ID, priority |
Ethernet Frame | Already has MAC addresses, type, data, CRC |
Traversal: IP still used, link layer provides VLAN identification | ㅤ |
🧠 VLAN is logical, not physical distinction
✅ VLAN Example (Port-Based)
Switch Port | VLAN ID |
1–8 | 10 (for EE Department) |
9–15 | 20 (for CS Department) |
16 | 30 (for specialized VLAN)** |
🔹 8. Ethernet Switching and ARP (Address Resolution Protocol)
✅ How Ethernet Switches Work
- When frame arrives, switch reads MAC address.
- If match, sends only on matching interface.
- If no match, floods frame on all interfaces except source.
✅ ARP: Details
- Calculates MAC address of device given IP address
- Broadcast Ethernet frame: to all nodes
- Unicast ARP reply: to requesting node
- Used for initial IP address discovery, DNS, HTTP
⚠️ ARP Maintains IP-Mac mappings in switch or host ARP table
🔹 9. Ethernet Switching Example
✅ Example with Two Switches (A -> B)
Step | Action |
1 | A sends frame to B |
2 | Switch 1 learns A's position |
3 | Switch 1 forwards frame to switch 2 |
4 | Switch 2 processes Mac B address |
5 | Switch 2 forwards frame to B's port |
6 | B receives frame, reads data, sends reply to A |
7 | Switch 2 learns B's position |
8 | Switch 1 learns B's position (from Switch 2) |
✅ Self-learning switches reduce configuration overhead
🔹 10. Link Layer Traffic Classification
✅ Key Traffic Classification Details
Transmission Model | Description |
Polling | Centralized controller receives all packets, schedules transmission |
Token Passing | Token is passed during transmission, only one node can send at a time |
CSMA/CD | Sender listens before transmitting, aborts if collision detected |
CSMA/CA | Collision Avoidance (e.g., Wi-Fi), pirate signals by using RTS/CTS |
Random Access | No coordination, collisions, retransmissions |
🔹 11. Cyclic Redundancy Check (CRC)
✅ CRC: Error Detection
- Given data (D), polynomial (G), length (r)
- Find remainder (R) so that: $ (D \cdot 2^r) \mod G = R $
- Receiver divides (D, R) by G. Non-zero indicates error
💡 Can detect:
- All burst errors less than r+1 bits
- Single-bit errors
- Even more powerful than parity
🔹 12. MAC Protocols: ALOHA, CSMA/CD, CSMA/CA
✅ ALOHA Protocols
Type | Description | Efficiency |
Pure ALOHA | Transmits anytime | Very low: ~0.18 |
Slotted ALOHA | Transmits at slot boundaries | Better: ~0.18 (same!) |
CSMA/CD | Senses, defers, detects collision | Efficient (wired) |
CSMA/CA | Avoids collision by using RTS/CTS | Efficient (wireless) |
🔁 Random access vs centralized access – different trade-offs
🔹 13. Link Layer Protocols & Their Applications
✅ Key Link Layer Tech
Protocol | Application |
Ethernet | Networked workstations, local networks, VLANS, MPLS |
VLANs | Network segmentation, security, performance |
MPLS | Path optimization, load balancing, redundancy |
Wi-Fi (802.11) | CSMA/CA, TSF synchronization, MAC learning |
Mobile Networks (e.g., 4G/5G) | Protocol Contention, Optimized traffic routing, OpenFlow |
🧠 Essential to remember: MPLS ≠ IP overload, but enhances IP forwarding!
🔹 14. Link Layer in Practical Networking
✅ Type of Information Network Activities
Task | Role |
Physical layer | Bit transmission over wired or wireless infrastructure |
Link layer | Frame encapsulation, MAC addressing, switches, VLANs |
Network layer | IP addressing, forwarding tables, routing: OSPF, BGP |
Transport layer | TCP, UDP, reliable & congestion control |
Application layer | HTTP, SMTP, ICMP, DNS |
🧓 Logical layers used hierarchically in Networking Mathematics and Transport-Layer $ rr(r) $
🔹 15. Ethernet Standards – 802.3
✅ Key Specifications
Standard | Speed | Description |
10BASE5 | 10 Mbps | Thick Ethernet, coaxial cable |
10BASE2 | 10 Mbps | Thin Ethernet, cable, hub |
100BASE-TX | 100 Mbps | Fast Ethernet, twisted-pair cable |
1000BASE-T | 1 Gbps | Gigabit Ethernet, twisted-pair |
10GBASE-T | 10 Gbps | 10 Gbps over copper cable, RJ45 |
🔁 Eth in wired environment vs Wi-Fi (wireless) – differing MAC protocols
🔹 16. Link Layer Exam Checklist
Topic | Must Know | Example |
MAC protocols | ✔️ | CSMA/CD, CSMA/CA, ALOHA |
Ethernet frame format | ✔️ | MAC addresses, CRC, type |
VLANs | ✔️ | Port-based, 802.1Q, trunking |
Switching | ✔️ | Self-learning, broadcasting, flooding |
ARP | ✔️ | **Ethernet frame with FF:FF:FF:FF:FF:FF |
Address resolution | ✔️ | IP to MAC mapping, persistent map (TTL) |
Traffic Engineering | ✔️ | MPLS, load balancing, redundancy |
Random Access | ✔️ | ALOHA, CSMA/CA, master-slave |
Switch vs Router | ✔️ | Link vs network, MAC vs IP, switch table vs routing table |
📌 Many key “link-layer” services are encapsulated into “data-plane” switches!
🧠 Pro Tip for Exams
You can now inspect and describe all aspects of a web request from IP to Link – that’s the goal of the 6th chapter! Here is a summary of how a web request is processed over 6 layers:
Layer | Action |
Application | Sends HTTP request |
Transport | Sends TCP segments, syn |
Network | IP datagrams end-to-end – network routing, forwarding |
Link | Ethernet frames, switches, ARP |
Physical | Bit stream delivered over cables, wire, radio |
🧭 Most routing is done at network layer, switching at link! You already know about link-layer through “Dijkstra” and “Bellman-Ford” from previous chapters!
📚 Practical Tools for Chapter 6
- Wireshark to decapsulate:
- Ethernet frame
- ARP request
- DNS over UDP
- HTTP (ECN, flow table)
- Packet Tracer/Mininet to simulate:
- Ethernet switches
- VLANs
- MPLS
- Understanding network-layer interconnection via switches, routers, and bridges
🧾 Key Slide Quotes (Summary!)
Original Quote | Topic |
“The Internet is today increasingly dictated by marketers, not by the architecture of the Internet.” | ORION SDN |
“The goal is connectivity, the tool is the Internet Protocol.” | BGP |
“You can form a reactor and AWS-2 venue from thousands of other fields.” | Flow Tables |
“MAC address is a 48-bit number, burned-in, unique.” | Ethernet |
“Link states are flooded.” | OSPF |
“Routers sense the network before transmission.” | CSMA/CD |
✅ Now Prepare for Chapter 7: Wireless Networks
On to again much more explicit working with wireless and MAC.
You have the basic understanding of the link layer now. Now prepare to master the wireless and MAC protocol in Chapter 7!
Good luck on your exam! 🧠You have finally mastered the link layer – from error detection to VLAN setup.
Now go out and grade your knowledge!






