Lazy loaded image
Wordsย 0Read Timeโ‰ˆย 1ย min
Invalid Date
ID
4

Chapter 4: Network Layer (Data Plane)


๐Ÿ”น 1. Network Layer Overview: Core Ideas

โœ… What is the Network Layer (Data Plane)?

  • Responsible for routing packets from source to destination
  • Encapsulates transport-layer (e.g., TCP/UDP) segments to form datagrams
  • Includes:
    • Forwarding: Process of receiving packet and sending it to the right output link
    • Routing: Process of determining the path from source to destination
    • Addressing: Assigning IP addresses to hosts and routers
    • Packet Schedule Data Plane: Buffering, scheduling, queueing
โš ๏ธ No reliability, flow, or congestion control โ€” functions are primarily at transport layer

๐Ÿ”น 2. Router Architecture / Data Plane Components

โœ… Key Parts of a Router

Function
Description
Input Ports
Handle arrival of datagrams from physical link, perform demultiplexing, lookup, queueing
Switch Fabric
Rapid transfer of packets from input port to output port, networking layer
Output Ports
Sends datagrams to physical link, performs multiplexing
Forwarding Table
Router uses this to determine which output link a packet should go to
Buffer Management
handles queueing, may cause delay or packet loss
Scheduling
decide which packet to send when โ€” options: FCFS, Priority, Round Robin, Weighted Fair
๐Ÿ’ก Data Plane: Execution, Forwarding, Queuing, Scheduling โ€” Network Layer Logic ๐Ÿ’ก Control Plane: Design โ€” Routing Algorithms, Forwarding Table, NAT/SDN Implications

๐Ÿ”น 3. Network Layer Protocols & Addressing

โœ… IP: Internet Protocol

  • most important network layer protocol
  • Each IP datagram has:
    • source IP address
    • destination IP address
    • header fields (e.g., fragment, TTL, checksum, options)
โœ… IP is connectionless and stateless โ€” best-effort, no guarantees

โœ… Subnetting & CIDR

  • CIDR (Classless Inter-Domain Routing): Allow routing by network prefixes
  • Subnets:
    • Subnet is group of IP addresses
    • Same high-order bits (prefix) โ†’ common network portion
    • Example:
      • IP address 223.1.1.1/24 โ†’ subnet 223.1.1.0/24
๐Ÿ’ก ่ต‡ prefix determines common routing; host part determines specific destinations

๐Ÿ”น 4. TCP/IP: A Working Example

  • Transport (TCP / UDP) โ†’ Network (IP) โ†’ Link (Ethernet/WiFi) โ†’ Physical (copper/radio)
  • Internet = layered system of packets + addressing
โ— This is the architecture of the Internet: flexible, scalable, layered protocol stacks

๐Ÿ”น 5. Subnets, Addressing, CIDR

โœ… Subnet Example (10.0.0.0/24)

  • Network portion: 10.0.0.0
  • Host portion: 0.0.0.0 โ€“ 0.0.0.255
  • You can have up to 254 IP addresses in this subnet

โœ… CIDR: Classless

  • CIDR notation: a.b.c.d/x, where x is prefix length
  • Example: 200.23.16.0/20
    • network portion = 20-bit
    • host portion = 12 bits
    • max 4096 IPs in this network
๐Ÿ” More specific route (more details) = more precise, better delegation

๐Ÿ”น 6. NAT: Network Address Translation

โœ… NAT Overview

  • NAT enables all devices in a local network to share a single public IPv4 address
  • Uses a NAT table to map:
    • LAN IP, port โ†’ WAN IP, port
  • Often embedded in router, helps reduce address exhaustion

โœ… NAT Translation Example

Before NAT
After NAT
Host A: 10.0.0.1:3345 โ†’ server: 128.119.40.186:80
NAT: 138.76.29.7:5001 โ†’ server:128.119.40.186:80
Router C: 138.76.29.7:5001 (WAN IP)
Nat table: (10.0.0.1:3345 โ†’ 138.76.29.7:5001)
Server E: 128.119.40.186:80 (WAN IP)
Router C sends to Server E using NAT IP
Host A: 10.0.0.1 โ†’ via deal with NAT
Host A receives response from Server E using NAT IP
โœ… Why NAT? โ†’ IPv4 Address exhaustion (only 4.3 billion address space)

๐Ÿ”น 7. IPv6: The Next Addressing Format

โœ… Why IPv6?

  • 128-bit address space โ†’ 3.4ร—10ยณโธ IPs
  • Simplified header (40 bytes) vs IPv4 (20+ bytes) โ†’ faster processing
  • No checksum โ†’ sends to router
  • No fragmentation โ†’ favors optimized routing at network layer
  • Enables scalable routing, programmable flow control (e.g., P4, SDN)

โœ… Address Format in IPv6

  • Human-readable format: aaaa:b000:0000:0000:0000:0000:0000:0001
  • Compression: aaaa::1 (leading, trailing zeros can be removed)
โš ๏ธ IPv6 not yet fully adopted โ€” but it's coming

โœ… Why is IPv6 being used?

  • Long time to deploy โ†’ 25 years!
  • IPv4 running out โ†’ NAT ends up being the only solution
  • Optimized packets: 40 bytes โ†’ Fast routing, less overhead

๐Ÿ”น 8. Packet Scheduling: Key Concepts

Scheduling
Type
Description
FCFS
First Come, First Served
Packets send in order of arrival
Priority
High โ†’ Low
Data is send to highest priority first
Round Robin
Cyclic
Each class sends one packet per cycle
Weighted Fair
Modify โ†’ Eq.
Class with higher weight gets more
Drop Policy
Identifies which datagram to drop when links are full.
ใ…ค
ECN (Explicit Congestion Notification)
Marks packet โ€” sender can adjust sending rate. Part of IPv4 and IPv6
ใ…ค
๐Ÿง  Key Insight: Scheduling and buffering determine network performance.

๐Ÿ”น 9. Congestion, Packet Loss, and Pack Buffering

โœ… Understanding the "packet loss" problem

  • Buffer overflow at router links โ†’ packets are dropped
  • Multihop steps:
    • Input queueing at one router
    • Output queueing at next hop
  • Both types can increase delay and cause loss

โœ… Buffer Size Rule of Thumb

  • Use RTT ร— link capacity (e.g., if R = 10 Gbps (10 billion bits/sec), RTT = 0.25 sec) โ†’ buffer โ‰ˆ 2.5 Gbit

๐Ÿ”น 10. Buffer Management: Real Life Implications

Buffering at Router
Impact on Network
Too small โ†’ delay, loss
Too large โ†’ higher delay
Must be ยซjust fullยป but no fuller
Helps TCP congestion control to work properly
๐Ÿ’ก Fixed QoS vs Dynamic BufferingSlot Allocation helps Slow, fast, or apply adaptive buffer sizes

๐Ÿ”น 11. Routing & Forwarding Fundamentals

โœ… The 2 Key Processes

Process
Function
Example
Forwarding
Move packet from input port to output port (one router)
Can be done by hardware (e.g., switch)
Routing
Determine path from source to destination (via network)
Done by router control-plane (e.g., OSPF, BGP, SDN controller)
โ— Forwarding โ‰  Routing โ— Forwarding is local, routing is global

๐Ÿ”น 12. Generalized Forwarding: Match + Action

โœ… Core Idea

  • Use header fields to match incoming packet โ†’ then act
  • Can be done at any layer (Link, Network, Transport)
Match
Action
MAC Address
Forward, drop, or flood
IP Address
Forward or drop
Port
Forward, block, or change
Link Layer (e.g., Ethernet type)
Forward or drop based on protocol
Controller
Match+action โ†’ send to central control plane
๐Ÿง  Match + Action allows programmable network infrastructure โ€” centralization + flexibility!

๐Ÿ”น 13. SDN: Software-Defined Networking

โœ… What is SDN?

  • Centralized control plane
  • Row-based routing, flow-based forwarding
  • Flow tables in switches โ†’ SDN controller manages them remotely

โœ… SDN Advantages

  • Easier control โ†’ policy across network easily enacted
  • Modern flexibility โ†’ programmable network
  • Future-oriented โ†’ matching OpenFlow, new P4, GFLOW tech
๐Ÿ’ก SDN is the future โ†’ network programmability at scale

๐Ÿ”น 14. Routing Protocols: BGP, OSPF

โœ… Need to know:

  • BGP (Border Gateway Protocol) โ†’ inter-AS (networks of different ISP)
  • OSPF (Open Shortest Path First) โ†’ intra-AS, uses link-state โ†’ Dijkstra
  • RIP (Routing Information Protocol) โ†’ distance vector, not covered
๐Ÿ“Œ BGP: coordination between ISPs, IXPs ๐Ÿ“Œ OSPF: internal medium/high-speed routing amid many devices

๐Ÿ”น 15. NAT: Network Address Translation (cont'd)

โœ… NAT simplifies addressing

  • List of IP addr. inside your home โ†’ only one public address to the Internet
  • Example: Home has 10 devices โ†’ 1 public IP
  • NLRA (Network Layer Routing Architecture) is not affected by NAT

โ— NAT Issues

  • End-to-End Principle: NAT violates this
  • Contributes to network complexity
  • Traversability: Hard for some Internet apps (e.g., WebRTC, VoIP)
  • Status: Still widely used, particularly in home / ISP / mobile networks

๐Ÿ”น 16. Flow Tables: Match + Action Extensibility

โœ… Fields in Flow Table

Match
Action
MAC, IP, TCP/UDP port
Drop, forward, change, or mark
Link-layer info (e.g., Ethernet, WiFi type)
Forward or drop
IP headers (e.g., ToS, Fragments, Flow Label)
Separate packets, send to controller
Priority
High, Medium, or Low
โœ… Flow table = router logic = monetary traffic handling at scale!

๐Ÿ”น 17. Middleboxes and OpenFlow

โœ… Middleboxes vs Routers

Feature
Router
Middlebox
Function
Forwarding only
Handles more features
Access
Always available
Runs software only
Operations
IP, routing
May include:
  • NAT
  • Firewall
  • Cache
  • Load Balancer

โœ… OpenFlow for Middleboxes

Match
Action
MAC, IP, TCP port
Forward, drop
Link-layer datagram type
Forward, drop
Caching
Encapsulate, forward
Firewall
Drop, forward, modify
Load Balancer
Forward to different servers
โœ… OpenFlow is NAT, Firewall, Cache, Load Balancer in one!

๐Ÿ”น 18. Buffering & Large Packets: Considerations

โœ… Why Fragment?

  • Mainly due to MTU (Maximum Transfer Unit) of the network interface
  • If IP datagram exceeds MTU, it is fragmented into smaller datagrams
  • Only reassembled at the destination โ†’ no intermediate reassembly

โœ… Fragments: Identification

Header Field
Purpose
ID
Identifies fragments of the same datagram
Offset
Gives fragment offset in bytes
Flags
Indicate if fragment can be last or more fragments exist
โš ๏ธ Fragments are expensive โ†’ reassembly inefficient

๐Ÿ”น 19. OpenFlow and P4: Enabling Programmable Networks

โœ… OpenFlow:

  • Packet match โ†’ controller notification
  • Can forward, drop, modify, or send to controller
  • Integrated with SDN, Middleboxes, Firewalls, Caches
  • Flow table allows:
    • Per-packet decisions
    • Rate shaping for traffic
    • Direct link to central controller

โœ… P4 (Programming Protocol-independent Data Plane)

  • P4 is a language for programmable networking
  • Allows you to program what actions the router takes
  • Flow tables from OpenFlow can use P4 for instance-level control
โœ… Why both? Let the hardware know network rules via P4 code โ†’ OpenFlow reapplies

๐Ÿ”น 20. Mid-Box: A Practical Overview

Category
Example
Key Function
Firewall
IP, port filtering
Secures network from external attacks
Cache
CDN, edge server
Reduces load on origin server
Load Balancer
configures to route packets to appropriate server
ใ…ค
NAT
home, cell, institutional
Replaces IP address with shared one
Content-bit filter
Video streaming
Decodes measured traffic, disposes of bad debris
Simple Trace
sleep, ping, ping6, iperf, ping
ใ…ค
๐Ÿ’ก Install iPerf + Wireshark โ†’ measure network bandwidth, simulate congestion

๐Ÿ”น 21. Addressing & Routing in Real Networks (Summary)

โœ… Addressing & Routing Assembly

Description
Assignment
Obtain IP address via DHCP
Random/assigned
Centralized control plane in SDN
ๆฏ”ๅฆ‚๏ผšMicrosoft Azure, Cisco gear, Segment Routing
use CIDR to handle subnet route delegation
Not IP only, but network layer, firewall, etc talk to controller
Track number of routes in your router
Bob expects to see 2โ€“4 entries, e.g.,: 223.1.1.0/24 accepted, 223.1.1.1 allowed, 223.1.1.2 dropped
โœ… Mandatory: Address manufacturing !

๐Ÿ”น 22. TCP/IP Protocol Suite: Architecture & Layering

  • IP is the core of the network
    • No guarantee for delivery, timing, or ordering
  • Transport layer (TCP, UDP) manages reliability, flow, ordering
  • Network layer deals with route selection, fragmentation, packet routing
  • Link layer (Ethernet, WiFi, etc.) sends bit stream over physical connections
  • Application layer (HTTP, SMTP, DNS) uses network layer (IP) to send packets to others
๐Ÿง  IP = network layer โ†’ data plane core of Internet

๐Ÿ”น 23. MAC vs IP: Routing Context

Overview:

  • MAC address is 128-bit, used for link layer (e.g., Ethernet, WiFi)
  • IP address is 32-bit (for IPv4), 128-bit (for IPv6) โ€” used for network layer
  • MAC addresses are used internally, while IP addresses are used externally

๐Ÿ”น Key Transitions

โ€ข Link layer (MAC) โ†’ Network layer (IP) โ€ข Network layer (IP) โ†’ Transport (TCP / UDP) โ€ข Transport โ†’ Application (DNS, HTTP)
โœ… Network layer can store packet in buffer, queue, schedule or drop

๐Ÿ”น 24. Exam Checklist (Chapter 4)

Topic
Must Know?
IP address, subnetting, CIDR
โœ”๏ธโœ”๏ธโœ”๏ธ
DHCP: request, offer, ack, and their timing
โœ”๏ธ
NAT: translation, table, public IP vs private IP
โœ”๏ธ
IPv6: address format, advantages, buffer size
โœ”๏ธ
Generalized forwarding: match + action
โœ”๏ธ
OpenFlow: match fields, action, flow tables
โœ”๏ธ
SDN: centralized control plane, flow tables
โœ”๏ธ
IP fragmentation: ID, offset, flags
โœ”๏ธ
Scheduling: FCFS, priority, RR, WFQ
โœ”๏ธ
Buffer management: practical implications
โœ”๏ธ
Control vs. data plane
โœ”๏ธ
SCS: Source Routing, Quality of Service
โœ”๏ธ

๐Ÿ”น 25. Introduction to P4 (Software-Defined Networks)

โœ… Key Idea: P4 = Language for the network

  • Complements OpenFlow โ†’ code the flow table
  • P4 is language for the hardware โ†’ controller manages code
  • Programmable datagram processing at network interface level โ†’ controls forwarding and queueing
โœ… P4 is the main programming tool for SDN networks.

๐Ÿ”น 26. Final Notes on Chapter 4

๐Ÿง  This is the core of the network layer โ€” buffering, addressing, routing, fragments, and flow control
๐Ÿ’ก Key differentiator of the Internet: simple, consistent data-plane ๐Ÿ’ก TCP uses TCP ACKs and duration-based timeouts for delivery ๐Ÿ’ก IP handles Flow (responsible for packet management)
๐Ÿงฉ Move up to Chapter 5: Running Networked Applications ๐Ÿ” Build understanding of routing protocols with BGP, OSPF ๐Ÿš€ Explore Internet layer with IP, NAT, IPv6 ๐Ÿงญ Traffic Engineering = Type of routing algorithm to maximize network efficiency

๐Ÿ“š Practice Tools for Chapter 4

  • Wireshark: Capture TCP/IP packets, analyze header fields
  • ipconfig, ifconfig: check current IP address, subnet, DHCP status
  • traceroute, tracert: see network path, witness subnets and router transitions
  • iperf: measure network bandwidth, simulate congestion

๐Ÿง‘โ€๐Ÿคโ€โ™‚๏ธ Pro Tip for Exams

Describe the network layer as:
  • Abstraction between transport & link
  • Focus on packets, not messages
  • Many packet fields, some buffers, some queues, some scheduling
  • Movement from input interface to output interface based on forwarding table
  • IP is 32-bit, no guarantee, newer versions are 128-bit
Suggestะฐัˆ: Given these questions, craft your answer around packet flows, NAT, CIDR, and IPv6, and tools like Wireshark to validate!

โœ… Summary Table โ€“ Network Layer Overview

Layer
Function
Protocol
Network Layer (Data Plane)
Forwarding, Routing, Addressing
IP, OpenFlow, P4, SDN
Transport
Reliable, ordered, flow-controlled
TCP, UDP
Application
Networks apps (HTTP, SMTP)
HTTP, SMTP, DNS, etc.
Link Layer
Data frame forwarding
Ethernet, WiFi (802.11)
Physical Layer
Wire carrying bits
Copper, Fiber, Radio

โœ… Exam Must-Know Checklist (Chapter 4)

Theme
Must Know?
Buffering & Latency
โœ”๏ธ
NAT: Private vs Public IP
โœ”๏ธ
Fragmentation & Reassembly
โœ”๏ธ
Routers & Link-Layer Handling
โœ”๏ธ
SDN Implemented via OpenFlow / P4
โœ”๏ธ
Match + Action
โœ”๏ธ
CIDR & Subnetting
โœ”๏ธ

๐Ÿ“Œ Where to Go Next?

  • Chapter 5: Running Networked Applications, Go-Back-N, TCP Flow & Congestion Control
  • Chapter 6: Link-Layer, Ethernet, WiFi
  • Chapter 7: Routing Protocols (BGP, OSPF), Flows, and IP address allocation by ISP
๐Ÿง  Your understanding of the data-plane is now solid Prepare for Extended Assignments that build on real-world packet processing!

Good luck on your exams! ๐Ÿ”ฅ This chapter 4 summary covers all the key factors, design assumptions, and core concepts you need to perform well on your Networks and Security course.
ไธŠไธ€็ฏ‡
COMP1323 Networks and Security Notes
ไธ‹ไธ€็ฏ‡
About This Blog

Comments
Loading...