Network and Data CommunicationsUnit 1212 min read
Medium Access Control & LAN Technologies: CSMA, Token Passing, Ethernet, Wi-Fi
Unit 12 of Network and Data Communications explores how devices share a communication medium in LANs, covering CSMA/CD, CSMA/CA, token passing, Ethernet standards (10BASE-T, 100BASE-TX), Wi-Fi (802.11), and collision handling, with real-world examples from eSewa, Daraz, and NTC networks.
TAKEAWAYS:
- Medium Access Control (MAC) determines who transmits when in shared networks, using methods like CSMA (with/without collision detection) or token passing.
- Ethernet (IEEE 802.3) uses CSMA/CD for wired LANs, while Wi-Fi (802.11) uses CSMA/CA to avoid collisions via RTS/CTS handshakes.
- Token passing (802.5) guarantees fair access but is slower; CSMA is faster but prone to collisions.
- Ethernet frames include Preamble, SFD, Destination/MAC, Type, Data, FCS, with minimum frame size (64 bytes) to detect collisions.
- Wi-Fi channels (2.4 GHz/5 GHz) use spread spectrum (DSSS, OFDM) to reduce interference; 802.11n/ac add MIMO for speed.
- Real-world use: eSewa’s payment queues (CSMA-like contention), Daraz’s order routing (Ethernet switches), NTC’s fiber backbones (token-ring legacy).
1. Why Medium Access Control (MAC)?
LANs connect multiple devices to a shared medium (cable, airwaves). Without MAC, devices would collide constantly. MAC protocols define:
- Who gets to transmit?
- How do they detect/avoid collisions?
- What happens if two devices transmit at once?
2. Contention-Based MAC: CSMA (Carrier Sense Multiple Access)
Devices listen before transmitting (like raising your hand in class). Two variants:
A. CSMA/CD (Collision Detection) – Wired Ethernet (802.3)
How it works:
- Carrier Sense: Device listens to the medium. If idle, it transmits.
- Collision Detection: While transmitting, it monitors for collisions (two signals overlapping).
- Collision Handling:
- If a collision is detected, both devices send a jam signal (32-bit pattern).
- Each waits a random backoff time (exponential backoff: 0–1, 0–3, 0–7 slots) before retrying.
Why exponential backoff? Avoids repeated collisions by making retries unpredictable.
Ethernet Frame Structure (with collision detection):
Worked Example: Collision in Daraz’s Order Processing
- Scenario: Two Daraz servers try to update the same inventory simultaneously.
- CSMA/CD in action:
- Server A sends "Update stock: Product X" (60-byte frame).
- Server B senses the medium is busy, waits.
- Server A finishes transmitting, but Server B starts just as A’s signal fades.
- Collision detected → Both send a jam signal.
- Both wait random backoff times (e.g., A waits 2 slots, B waits 5 slots) before retrying.
Advantages/Disadvantages:
| Pros | Cons |
|---|---|
| Simple, no central coordinator | Collisions waste bandwidth |
| Scalable for small networks | Performance degrades with load |
| Used in 10BASE-T, 100BASE-TX | Not suitable for wireless (hidden node problem) |
B. CSMA/CA (Collision Avoidance) – Wi-Fi (802.11)
Wireless networks have the hidden node problem: Two devices may not hear each other but collide at the access point (AP).
How CSMA/CA avoids collisions:
- Carrier Sense: Device checks if the medium is free.
- Random Backoff: If free, it waits a random time before transmitting.
- RTS/CTS Handshake (optional but used in dense networks):
- Request to Send (RTS): Sender asks AP for permission.
- Clear to Send (CTS): AP replies, silencing other devices.
- Data Transmission: Sender transmits; others hear CTS and wait.
Wi-Fi Frame Exchange (with RTS/CTS):
sequenceDiagram
participant Sender as Device A
participant AP as Access Point
participant Receiver as Device B
participant Others as Other Devices
Sender->>AP: RTS (Request to Send)
AP->>Others: CTS (Clear to Send)
Sender->>Receiver: Data Frame
Receiver->>Sender: ACKWorked Example: NTC’s Wi-Fi Hotspots
- Scenario: Multiple users in a café connect to NTC’s Wi-Fi.
- CSMA/CA in action:
- User 1’s laptop senses the channel is free and waits 3 slots.
- User 2’s phone senses the channel is free but waits 1 slot.
- User 2 transmits first (shorter backoff). User 1 hears the transmission and backs off.
- If User 1 had sent an RTS, the AP would reply with CTS, telling User 2 to wait.
Advantages/Disadvantages:
| Pros | Cons |
|---|---|
| Avoids collisions via handshakes | Overhead from RTS/CTS |
| Works in wireless environments | Hidden node problem persists |
| Used in 802.11 (Wi-Fi) | Slower than wired Ethernet |
3. Token-Passing MAC (802.5 – Token Ring)
Instead of contention, devices take turns using a token:
- Only the device holding the token can transmit.
- After transmitting, it passes the token to the next device.
How Token Ring Works:
- A token frame circulates the ring.
- A device wanting to transmit:
- Waits for the token.
- Converts the token to a data frame and transmits.
- The destination copies the data and sends an ACK.
- The sender removes the frame and releases a new token.
- If no one transmits, the token keeps circulating.
Token Frame Structure:
Real-World Example: Ncell’s Legacy Token-Ring Networks
- Scenario: In the 1990s, Ncell used token-ring LANs in some office networks.
- Why? Guaranteed access for critical calls (no collisions).
- Downside: Slower than Ethernet for bursty traffic (e.g., file transfers).
Advantages/Disadvantages:
| Pros | Cons |
|---|---|
| No collisions | Token loss can halt the network |
| Fair access | Slower than CSMA for light loads |
| Deterministic timing | Complex wiring (ring topology) |
4. LAN Technologies: Ethernet vs. Wi-Fi
| Feature | Ethernet (802.3) | Wi-Fi (802.11) |
|---|---|---|
| MAC Method | CSMA/CD | CSMA/CA |
| Medium | Twisted-pair, fiber | Radio waves (2.4 GHz/5 GHz) |
| Collision Handling | Jam signal + backoff | RTS/CTS handshake |
| Speed | 10 Mbps–400 Gbps (10BASE-T to 802.3bz) | 1–6000 Mbps (802.11n to 802.11be) |
| Range | Limited by cable length (~100m) | ~100m (indoor), extends with APs |
| Hidden Node Problem | No (wired) | Yes (requires RTS/CTS) |
| Example Use | Daraz’s data center, eSewa servers | Pathao’s rider tracking, home Wi-Fi |
5. Ethernet Standards (Wired LANs)
| Standard | Name | Speed | Medium | Collision Domain |
|---|---|---|---|---|
| 802.3 | 10BASE-T | 10 Mbps | Twisted-pair | Yes (hub) |
| 802.3u | 100BASE-TX | 100 Mbps | Twisted-pair | Yes (hub) |
| 802.3ab | 1000BASE-T | 1 Gbps | Twisted-pair | No (switch) |
| 802.3bz | 2.5G/5GBASE-T | 2.5–5 Gbps | Twisted-pair | No (switch) |
| 802.3ae | 10GBASE-T | 10 Gbps | Twisted-pair/fiber | No (switch) |
Key Takeaway:
- Hubs create collision domains (all ports share the same segment).
- Switches eliminate collisions by forwarding frames to specific ports.
6. Wi-Fi Technologies (802.11)
| Standard | Frequency | Max Speed | Modulation | Key Feature |
|---|---|---|---|---|
| 802.11b | 2.4 GHz | 11 Mbps | DSSS | First widely used Wi-Fi |
| 802.11g | 2.4 GHz | 54 Mbps | OFDM | Backward-compatible with b |
| 802.11n | 2.4/5 GHz | 600 Mbps | MIMO + OFDM | Multiple antennas (speed) |
| 802.11ac | 5 GHz | 3.5 Gbps | MU-MIMO + OFDM | Gigabit speeds, less interference |
| 802.11ax | 2.4/5/6 GHz | 9.6 Gbps | OFDMA + MU-MIMO | Better for crowded networks |
How Wi-Fi Channels Work:
- 2.4 GHz: 11 channels (overlapping in most regions).
- 5 GHz: 23 non-overlapping channels (less interference).
- 6 GHz (802.11be): 59 channels (for ultra-fast Wi-Fi 6E).
7. Real-World Applications
A. eSewa’s Payment Queues (CSMA-like Contention)
- Problem: Multiple users submit payments simultaneously.
- Solution: eSewa’s backend uses priority queues (similar to CSMA’s backoff).
- High-priority transactions (e.g., bill payments) get shorter backoff times.
- Low-priority transactions (e.g., top-up) wait longer.
B. Daraz’s Order Routing (Ethernet Switches)
- Problem: Orders from Kathmandu and Pokhara must reach the warehouse without collisions.
- Solution: Daraz uses Layer 2 switches to forward frames directly to the warehouse’s MAC address.
- No broadcast storms (unlike hubs).
- VLANs separate order processing from inventory updates.
C. NTC’s Fiber Backbone (Token-Ring Legacy)
- Scenario: NTC’s old SDH (Synchronous Digital Hierarchy) rings used token-like synchronization.
- Why? Guaranteed bandwidth for voice/data (critical for telecom).
D. Pathao’s Rider Tracking (Wi-Fi + CSMA/CA)
- Problem: Riders’ phones must upload GPS data without collisions.
- Solution: Pathao’s servers use 802.11ac Wi-Fi with:
- RTS/CTS to avoid collisions in dense areas (e.g., Thamel).
- MU-MIMO to serve multiple riders simultaneously.
8. Exam Tip: How This Unit is Tested
Definitions & Comparisons (3–5 marks)
- Differentiate CSMA/CD vs. CSMA/CA vs. Token Passing.
- Explain why Ethernet uses CSMA/CD but Wi-Fi uses CSMA/CA.
Scenario-Based Questions (5–7 marks)
- "Two devices in a Wi-Fi network collide. How does CSMA/CA resolve this?"
- "Why does a 60-byte Ethernet frame cause a collision?" (Hint: Minimum frame size is 64B.)
Diagrams (4–6 marks)
- Draw an Ethernet frame and label its fields.
- Sketch a token-ring network with devices A, B, C.
- Show RTS/CTS handshake in Wi-Fi.
Real-World Applications (3–5 marks)
- "How does Daraz use Ethernet switches to avoid collisions?"
- "Why does NTC prefer fiber over Wi-Fi for backhaul?"
Common Mistakes to Avoid:
- Forgetting exponential backoff in CSMA/CD.
- Confusing CSMA/CA’s RTS/CTS with TCP’s 3-way handshake.
- Ignoring the minimum frame size (64B) in collision detection.
- Mixing up 802.3 (Ethernet) and 802.11 (Wi-Fi) standards.
Final Note: MAC protocols are the traffic cops of LANs. Master CSMA/CD, CSMA/CA, and token passing, and you’ll ace the practical and theoretical parts of this unit!
Based on the TU BIT syllabus for Network and Data Communications (BIT254), unit 12.
Discussion
Loading…