Unit 3 - Notes

CSE306 8 min read

Unit 3: TRANSPORT LAYER: CONGESTION CONTROL

1. Introduction to Congestion Control

Congestion in a network occurs when the number of packets being transmitted through the network approaches or exceeds the packet-handling capacity of the network. This leads to packet loss, increased delays, and wasted resources. Congestion control mechanisms are essential to prevent network collapse and ensure fair resource allocation.

Network-Assisted Congestion Control Algorithms

In network-assisted congestion control, the network layer components (like routers) provide explicit feedback to the sender regarding the congestion state of the network.

  • Choke Packets: A choke packet is a control packet generated by a congested router and sent back to the source. When the source receives the choke packet, it must reduce its transmission rate. ICMP Source Quench is a historical example of this.
  • Explicit Congestion Notification (ECN): ECN is an extension to the IP and TCP protocols.
    • Instead of dropping packets when a router's queue gets full, the router sets two specific bits in the IP header (ECN bits) to indicate impending congestion.
    • The receiver echoes this congestion indication back to the sender in the TCP ACK header (using the ECE - ECN-Echo bit).
    • The sender then reacts by halving its congestion window, exactly as if a packet loss had occurred.
  • DECbit: A binary feedback mechanism where routers set a specific bit in the packet header if the average queue length exceeds a threshold. The receiver copies this bit into the acknowledgment. If more than 50% of the ACKs in a window have the bit set, the sender decreases its window; otherwise, it increases it.

TCP Congestion Control

TCP uses an end-to-end congestion control approach (no explicit feedback from the network layer is strictly required; congestion is inferred from packet loss). TCP maintains a Congestion Window (cwnd) and a Receiver Window (rwnd). The actual transmission rate is dictated by min(cwnd, rwnd).

TCP Congestion Control consists of four main phases/algorithms:

  1. Slow Start:
    • TCP begins with a small cwnd (usually 1 Maximum Segment Size, MSS).
    • For every ACK received, cwnd is increased by 1 MSS.
    • This results in an exponential increase in the window size (1, 2, 4, 8, 16...).
    • The slow start phase continues until cwnd reaches the Slow Start Threshold (ssthresh) or a packet loss occurs.
  2. Congestion Avoidance (AIMD - Additive Increase Multiplicative Decrease):
    • Once cwnd >= ssthresh, TCP enters Congestion Avoidance.
    • Additive Increase: cwnd is increased by 1 MSS per RTT (Round Trip Time). This results in a linear increase.
    • Multiplicative Decrease: If congestion occurs (inferred by packet loss), TCP drastically reduces the transmission rate.
  3. Fast Retransmit:
    • If a sender receives three duplicate ACKs for the same data, it assumes the subsequent packet was lost.
    • It retransmits the missing packet immediately, without waiting for the timeout timer to expire.
  4. Fast Recovery:
    • Following Fast Retransmit, ssthresh is set to cwnd / 2.
    • cwnd is set to ssthresh + 3 MSS.
    • TCP bypasses the Slow Start phase and goes directly into Congestion Avoidance.
    • Note: If a timeout occurs (instead of duplicate ACKs), ssthresh is halved, but cwnd is dropped back to 1 MSS, restarting the Slow Start phase.

2. NETWORK LAYER: Services and Performance

While the Transport Layer guarantees end-to-end communication, the Network Layer is responsible for host-to-host communication and moving packets across multiple networks.

Network Layer Services

  1. Packetizing: Encapsulating payload data from the transport layer into network layer packets (datagrams) at the source, and decapsulating them at the destination.
  2. Routing: Determining the optimal path a packet should take from source to destination using routing algorithms (e.g., OSPF, BGP).
  3. Forwarding: The action of moving an incoming packet from a router's input port to the appropriate output port based on the forwarding table.
  4. Logical Addressing (IP Addressing): Assigning globally unique logical addresses to devices to identify them across interconnected networks.
  5. Fragmentation and Reassembly: Breaking down large packets into smaller fragments if they exceed the Maximum Transmission Unit (MTU) of the underlying link-layer network, and reassembling them at the destination.

Network Layer Performance

Network performance is measured using several key metrics:

  • Delay (Latency): The total time it takes for a packet to travel from source to destination. It comprises:
    • Processing Delay: Time taken by routers to examine the packet header and determine the output port.
    • Queuing Delay: Time the packet spends waiting in the router's queue before transmission.
    • Transmission Delay: Time taken to push all bits of the packet onto the link (, where L is packet length and R is link bandwidth).
    • Propagation Delay: Time for a signal to travel across the physical medium (, where d is distance and s is propagation speed).
  • Throughput: The actual rate at which data is successfully transferred from source to destination (measured in bits per second, bps). It is usually limited by the bottleneck link in the path.
  • Packet Loss: The percentage of packets that fail to reach their destination, typically due to buffer overflows at congested routers.
  • Jitter: The variation in packet delay. High jitter is detrimental to real-time applications like VoIP or video streaming.

3. NETWORK LAYER: IP Addressing

An IP (Internet Protocol) address is a logical address assigned to every device connected to a computer network. IPv4 addresses are 32 bits long, typically written in dotted-decimal notation (e.g., 192.168.1.1). An IP address consists of a Network ID and a Host ID.

Classful IP Addressing

Historically, the IPv4 address space was divided into five fixed classes (A, B, C, D, and E) based on the leading bits of the address.

Class Leading Bits Range of First Octet Network Bits Host Bits Default Subnet Mask Purpose
A 0 1 to 126 8 24 255.0.0.0 Very large networks
B 10 128 to 191 16 16 255.255.0.0 Medium-sized networks
C 110 192 to 223 24 8 255.255.255.0 Small networks
D 1110 224 to 239 N/A N/A N/A Multicast
E 1111 240 to 255 N/A N/A N/A Experimental/Reserved

Note: 127.x.x.x is reserved for loopback testing (localhost).
Disadvantage of Classful Addressing: It leads to immense address depletion and wastage. For example, an organization needing 300 IP addresses would require a Class B network (65,534 hosts), wasting over 65,000 addresses.

Classless IP Addressing (CIDR)

To solve the address wastage problem, Classless Inter-Domain Routing (CIDR) was introduced.

  • CIDR eliminates the concept of fixed network classes.
  • It uses a variable-length subnet mask to define the network and host portions.
  • Notation: Expressed as IP_Address/n, where /n (CIDR block) indicates the number of bits used for the Network ID.
  • Example: 192.168.1.0/26 means 26 bits are for the network, leaving 6 bits for hosts ( usable hosts).

4. Subnetting and Supernetting

Subnetting

Subnetting is the process of dividing a single, large logical network into multiple smaller, manageable physical networks (subnets).

  • Mechanism: It works by "borrowing" bits from the Host ID portion of the IP address and using them to create a Subnet ID.
  • Advantages: Reduces broadcast traffic, improves network security, and organizes network architecture efficiently.
  • Formulas:
    • Number of subnets created = (where is the number of borrowed bits).
    • Number of usable hosts per subnet = (where is the remaining host bits). We subtract 2 because the all-zeros host ID is the Network Address, and the all-ones host ID is the Broadcast Address.

Supernetting (Route Aggregation)

Supernetting is the inverse of subnetting. It combines multiple contiguous smaller networks into a single larger network.

  • Mechanism: It works by moving the subnet mask boundary to the left, borrowing bits from the Network ID portion.
  • Advantages: Reduces the size of routing tables in routers (Route Summarization), speeding up the routing process and saving router memory.
  • Rule: For networks to be supernetted, they must be contiguous, and the number of networks must be a power of 2.

5. Subnetting Examples

Example 1: Subnetting a Class C Network

Scenario: You are given the IP address 192.168.10.0/24. You need to create 4 subnets for different departments.

  1. Determine Borrowed Bits:
    • We need 4 subnets. .
    • We borrow 2 bits from the host portion.
  2. Calculate New Subnet Mask:
    • Original mask: /24 (255.255.255.0).
    • New mask: /26 ().
    • In binary: 11111111.11111111.11111111.11000000
    • Decimal mask: 255.255.255.192.
  3. Determine Hosts per Subnet:
    • Remaining host bits (): bits.
    • Usable hosts per subnet: hosts.
  4. Determine the Block Size (Magic Number):
    • . Subnets will increment by 64 in the 4th octet.
  5. Subnet Ranges:
Subnet Number Network Address Usable Host Range Broadcast Address
Subnet 1 192.168.10.0 192.168.10.1 - 192.168.10.62 192.168.10.63
Subnet 2 192.168.10.64 192.168.10.65 - 192.168.10.126 192.168.10.127
Subnet 3 192.168.10.128 192.168.10.129 - 192.168.10.190 192.168.10.191
Subnet 4 192.168.10.192 192.168.10.193 - 192.168.10.254 192.168.10.255

Example 2: Host Requirement Based Subnetting

Scenario: You have 172.16.0.0/16 and need a subnet that supports 500 hosts.

  1. Determine Host Bits Needed:
    • We need .
    • . Therefore, we need host bits.
  2. Determine Subnet Mask:
    • Network bits = Total bits (32) - Host bits (9) = 23 bits (/23).
    • Subnet mask: 11111111.11111111.11111110.00000000 -> 255.255.254.0.
  3. Identify First Subnet Parameters:
    • Block size in the 3rd octet: .
    • Network Address: 172.16.0.0/23
    • Usable Hosts: 172.16.0.1 to 172.16.1.254
    • Broadcast Address: 172.16.1.255