Computer NetworkingUnit 513 min read
HDLC & PPP: Frame Formats, Flow Control & Point-to-Point Links
Unit 5 of Computer Networking explains HDLC (High-Level Data Link Control) and PPP (Point-to-Point Protocol) frame structures, their roles in synchronous/asynchronous communication, error control mechanisms, and real-world applications in dial-up, broadband, and VPN connections. Covers Go-Back-N ARQ, bit stuffing, and
TAKEAWAYS:
- HDLC and PPP are bit-oriented data link protocols that encapsulate network layer packets into frames for reliable transmission over point-to-point links.
- HDLC uses three frame types (I-frame, S-frame, U-frame) with 0x7E flags and bit stuffing to avoid flag emulation, while PPP uses LCP (Link Control Protocol) and NCP (Network Control Protocol) for negotiation.
- Go-Back-N ARQ improves efficiency over Stop-and-Wait by allowing multiple unacknowledged frames (sliding window) but requires sequence numbers and retransmissions of all frames after the first error.
- PPP supports multiple network layer protocols (IPv4/IPv6) via Protocol Field (0x0021 for IPv4) and includes error detection via CRC-16 in its frame trailer.
- Real-world uses: PPP in Ncell’s 4G/5G modems, HDLC in NTC’s SDH/SONET fiber links, and PPP over Ethernet (PPPoE) in Khalti’s internet banking.
- Exam focus: frame format diagrams, ARQ protocol traces, and comparison tables between HDLC/PPP and Stop-and-Wait/Go-Back-N.
1. Why HDLC and PPP? The Role of Data Link Layer Protocols
The Data Link Layer (Layer 2) is responsible for:
- Framing: Breaking network layer packets into frames and adding headers/trailers.
- Error control: Detecting/correcting errors using checksums or ARQ protocols.
- Flow control: Managing sender/receiver speeds to prevent buffer overflows.
- Access control: Regulating when devices transmit (critical in shared media like Ethernet).
HDLC and PPP are point-to-point protocols, meaning they operate between two directly connected devices (e.g., router-to-router, PC-to-modem). Unlike broadcast protocols (e.g., Ethernet), they assume a dedicated link with no collisions.
2. HDLC: The Bit-Oriented Workhorse
2.1 HDLC Frame Format
HDLC (High-Level Data Link Control) is an ISO standard (ISO 3309/4335) designed for synchronous transmission. Its frame has 8-bit fields (unlike byte-oriented protocols like SDLC, which uses 8-bit delimiters).
+------------+------------+------------+---------------+---------------+------------+
| Flag (0x7E)| Address | Control | Information | FCS (CRC-16) | Flag (0x7E)|
+------------+------------+------------+---------------+---------------+------------+
- Flag (0x7E): Marks frame start/end. Contains
01111110(binary). - Address: Identifies the secondary station (e.g.,
0xFFfor broadcast). - Control: Defines frame type (I-frame, S-frame, U-frame) and sequence numbers.
- Information: Payload (network layer packet).
- FCS (Frame Check Sequence): CRC-16 for error detection.
2.2 HDLC Frame Types
HDLC supports three frame types, each with a unique role:
| Frame Type | Purpose | Control Field Format | Example Use Case |
|---|---|---|---|
| I-frame | Carries user data + sequence numbers | 0 SSSS P RRRR (8 bits) |
Transferring IPv4 packets in NTC’s fiber backbone. |
| S-frame | Supervisory: ACK/NAK, flow control | 1 0 PPPP (P=Poll bit) |
Acknowledging receipt of I-frames. |
| U-frame | Unnumbered: Setup/teardown, tests | 1 1 PPPP |
Establishing a link (e.g., PPP negotiation). |
- Sequence Numbers: I-frames use modulo-8 sequence numbers (
SSSSin control field) for ARQ. - Poll/Final Bits: Used for master-slave communication (e.g., router polling a modem).
2.3 Bit Stuffing in HDLC
HDLC uses bit stuffing to avoid false flags (when 0x7E appears in data):
- After 5 consecutive
1s, a0is inserted. - Receiver removes stuffed
0s after 51s. - Example:
- Sender data:
1111101111111 - After stuffing:
111110 0 111110 0 111111(flags added:0x7E...0x7E).
- Sender data:
Why? Prevents the receiver from misinterpreting 1111110 (6 1s) as a flag (01111110).
3. PPP: The Modern Point-to-Point Protocol
PPP (Point-to-Point Protocol) is the de facto standard for asynchronous/synchronous links (e.g., dial-up, DSL, VPNs). It replaces older protocols like SLIP and HDLC in most modern networks.
sequenceDiagram
participant Modem as PPP Modem
participant Router as PPP Router
Modem->>Router: LCP Configure-Request (Auth: CHAP, Compression: Predictor)
Router->>Modem: LCP Configure-Ack
Modem->>Router: IPCP Configure-Request (IP: 192.168.1.1)
Router->>Modem: IPCP Configure-Ack
Modem->>Router: IPv4 Packet (Protocol=0x0021)
Router->>Modem: ACK (FCS=CRC-16)
note right of Router: Link remains active until LCP Terminate-RequestPPP handshake in Ncell’s 4G modem: LCP negotiation → NCP (IPCP) → data transfer.3.1 PPP Frame Format
PPP uses a simpler 3-field structure (no address/control fields for point-to-point):
+------------+------------+---------------+---------------+------------+
| Flag (0x7E)| Address | Control | Protocol | Payload | FCS (CRC-16)|
+------------+------------+---------------+---------------+------------+
- Flag: Same as HDLC (
0x7E). - Address: Always
0xFF(broadcast). - Control: Always
0x03(unnumbered frame). - Protocol: Identifies network layer protocol (e.g.,
0x0021= IPv4,0x0057= X.25). - FCS: CRC-16 (same as HDLC).
3.2 PPP’s Two-Phase Operation
PPP establishes a link in two phases:
- Link Establishment (LCP):
- Negotiates encapsulation, authentication (PAP/CHAP), and compression.
- Uses LCP frames (e.g.,
Configure-Request,Configure-Ack).
- Network Layer Protocol (NCP):
- Configures IPv4/IPv6 (via IPCP), IPX, etc.
- Example:
IPCP Configure-Requestassigns an IP address.
Example Trace (PPP Dial-Up):
1. Modem connects → PPP Link Established (LCP).
2. LCP negotiates CHAP authentication.
3. IPCP assigns IP (e.g., 192.168.1.100).
4. User data (HTTP/HTTPS) sent via PPP frames.
3.3 PPP vs. HDLC: Key Differences
| Feature | HDLC | PPP |
|---|---|---|
| Design | ISO standard, bit-oriented | RFC 1661, flexible |
| Frame Types | I/S/U frames | Single frame type (simpler) |
| Error Control | CRC-16, ARQ (Go-Back-N) | CRC-16, optional ARQ |
| Protocol Support | Limited (often IP-only) | Multi-protocol (IPv4/IPv6/IPX) |
| Authentication | None (unless extended) | PAP/CHAP |
| Use Case | Legacy WAN (Frame Relay), NTC fiber | Dial-up, DSL, VPNs (Ncell 4G) |
4. Go-Back-N ARQ: The Sliding Window Protocol
ARQ (Automatic Repeat reQuest) is an error recovery mechanism. Go-Back-N is an optimized version of Stop-and-Wait that allows multiple unacknowledged frames.
4.1 How Go-Back-N Works
- Sender transmits N frames without waiting for ACKs (sliding window).
- Receiver ACKs the highest in-order frame (cumulative ACK).
- If a timeout or NAK occurs, sender retransmits all frames after the lost one.
Example Trace (N=4):
Sender Window: [1, 2, 3, 4] (sent)
Receiver ACKs: 3 (frame 3 received)
Action: Sender retransmits 4 (since 3 was ACKed, but 4 may be lost).
4.2 Go-Back-N vs. Stop-and-Wait
| Feature | Stop-and-Wait | Go-Back-N |
|---|---|---|
| Window Size | 1 (waits for ACK) | N (multiple unACKed frames) |
| Efficiency | Low (idle time) | High (pipelining) |
| Retransmission | Only lost frame | All frames after lost one |
| Use Case | Low-bandwidth links | High-speed links (PPP, HDLC) |
Real-World Example: Ncell’s 4G Retransmissions
- When a user streams YouTube, TCP (transport layer) uses Go-Back-N-like logic.
- If a packet is lost, TCP retransmits all packets after the lost one (unless SACK is used).
5. In the Real World
5.1 PPP in Ncell’s 4G/5G Modems
- How it’s used: When you connect to Ncell’s 4G network, your phone uses PPP over LTE (PPPoLTE) to negotiate an IP address.
- Key idea: PPP’s LCP phase authenticates your SIM (via CHAP) and assigns an IP (via IPCP).
- Example: Your phone sends a
PPP Echo-Requestto check link health, just like a router pinging a neighbor.
5.2 HDLC in NTC’s Fiber Optic Backbone
- How it’s used: NTC’s SDH/SONET fiber links use HDLC-like framing for synchronous data transfer.
- Key idea: HDLC’s I-frames carry MPLS labels (used in NTC’s core routing).
- Example: If a fiber cut occurs in Kathmandu, HDLC’s Go-Back-N ARQ ensures no packet loss by retransmitting corrupted frames.
5.3 PPP over Ethernet (PPPoE) in Khalti’s Internet Banking
- How it’s used: When you log into Khalti’s website, your ISP (e.g., Worldlink) uses PPPoE to authenticate you over Ethernet.
- Key idea: PPPoE encapsulates PPP frames in Ethernet, allowing dynamic IP assignment.
- Example: Your bank transaction data travels as:
Ethernet Frame → PPPoE Session → PPP Frame → IP Packet → HTTPS.
6. Exam Tip: What to Focus On
6.1 High-Weightage Topics
- HDLC Frame Format: Memorize the 3 frame types (I/S/U) and bit stuffing rule.
- PPP Frame Fields: Know the Protocol Field values (
0x0021for IPv4). - Go-Back-N ARQ: Draw a sequence diagram with sender/receiver windows and retransmissions.
- Comparisons: Be ready to compare HDLC vs. PPP and Go-Back-N vs. Stop-and-Wait.
6.2 Common Pitfalls
- Bit stuffing: Forgetting to insert a
0after 5 consecutive1s (not 6). - PPP LCP/NCP: Confusing Link Control (LCP) with Network Control (NCP).
- ARQ examples: Not showing cumulative ACKs in Go-Back-N traces.
6.3 Model Answer Structure
For questions like "Explain HDLC frame formats":
- Define HDLC (1 mark).
- Draw the frame (label all fields) (3 marks).
- Explain bit stuffing (2 marks).
- Give a real-world example (e.g., NTC fiber) (2 marks).
In the real world
- NTC’s SDH/SONET fiber backbone: Uses HDLC’s I-frames for reliable transmission of IPv4/IPv6 packets between routers, with bit stuffing to prevent flag emulation in high-speed links (e.g., Kathmandu–Pokhara backbone).
- Ncell’s 4G/5G modems: Deploy PPP’s LCP/NCP phases to negotiate IP addresses (via IPCP) and authenticate users (CHAP) before handing off data to the core network.
- Khalti’s internet banking: Implements PPPoE (PPP over Ethernet) to encapsulate PPP frames in Ethernet, ensuring secure authentication before processing transactions over the NTC fiber network.
Based on the TU BCA syllabus for Computer Networking (CACS303), unit 5.
Discussion
Loading…