Forwarding per-hop behavior (PHB) for QoS - CSU359 - Shoolini University

Forwarding per-hop behavior (PHB) for QoS

0. Forwarding Per-Hop Behavior (PHB) Overview

Forwarding Per-Hop Behavior (PHB) is a fundamental concept in the Differentiated Services (DiffServ) architecture, which is part of Quality of Service (QoS) models in networking. PHB defines how individual network devices (routers or switches) handle packets at each hop, based on the packet’s classification. Instead of focusing on end-to-end connections, PHB ensures that traffic is treated appropriately at each node it passes through, maintaining QoS guarantees such as prioritization, delay control, and bandwidth allocation.

0.1 Role of PHB in QoS

PHB is central to achieving QoS by categorizing traffic into different service levels, ensuring that high-priority traffic receives better treatment than lower-priority traffic. For example, critical real-time traffic (such as VoIP) can be expedited, while less important traffic (such as bulk file transfers) may be delayed or dropped during congestion.

PHB is based on packet marking, typically through the Differentiated Services Code Point (DSCP) in the IP header, which determines the QoS treatment that packets will receive.

0.2 Key PHB Types

There are several standard types of PHB that provide different levels of service to traffic:

  • Default Forwarding (DF): The default behavior for packets with no special marking, which receives best-effort service without any QoS guarantees.
  • Expedited Forwarding (EF): A high-priority PHB that provides low-latency, low-loss service for real-time applications such as voice and video. EF-queued packets are typically forwarded ahead of other traffic.
  • Assured Forwarding (AF): A set of PHBs that guarantee different levels of delivery assurance and drop precedence. AF is divided into multiple classes (AF1, AF2, etc.), each with different levels of reliability.
  • Class Selector PHBs: These PHBs map legacy IP Precedence values to DSCP markings, ensuring backward compatibility with older QoS mechanisms.

0.3 PHB and Traffic Classification

Traffic classification plays a key role in PHB by identifying which traffic belongs to which class. Once classified, packets are marked with a DSCP value that corresponds to a specific PHB. This value is used by each network device along the packet's path to apply the correct QoS treatment.

  • For example, EF-marked packets are given high priority at every hop, ensuring low-latency service for real-time applications.
  • AF-marked packets may be assigned varying levels of reliability, based on the network's load and conditions, with lower-priority AF packets more likely to be dropped during congestion.

0.4 Per-Hop Behavior and Congestion Control

PHBs work in conjunction with congestion control mechanisms to ensure that critical traffic is delivered even in times of high network load. For example, high-priority traffic such as EF flows are protected by placing them in priority queues, while lower-priority traffic can be delayed, dropped, or shaped to fit within the available network capacity.

By controlling how packets are handled at each hop, PHBs ensure that network resources are allocated effectively and that QoS objectives are maintained across the network.

1. Forwarding Per-Hop Behavior (PHB) for Quality of Service (QoS)

Forwarding Per-Hop Behavior (PHB) is a fundamental concept in Quality of Service (QoS) mechanisms, particularly in Differentiated Services (DiffServ) architecture. It defines how packets are treated at each network hop, ensuring that traffic is managed according to predefined policies. Each hop refers to a router or a network device through which the packet passes on its journey.

1.1 PHB and Traffic Classification

Traffic classification is a crucial step in QoS, where packets are grouped based on similar characteristics or service requirements. Once classified, each packet is assigned a PHB to ensure appropriate handling.

  • Classification: The process of identifying and marking packets based on specific fields like IP addresses, port numbers, or protocol types. This is often done using filters or rules that place traffic into different classes.
  • Marking: After classification, packets are marked in their headers, typically using the Differentiated Services Code Point (DSCP) field in IPv4/IPv6. This marking determines the PHB applied to the packet at each hop.

1.2 Types of PHBs

PHBs define how packets are handled based on their classification. The most commonly defined PHBs are:

  • Default Forwarding (DF): This is the standard treatment for packets that do not require special QoS. These packets are forwarded with best-effort service.
  • Expedited Forwarding (EF): This PHB provides low delay, low loss, and low jitter, making it ideal for real-time traffic such as VoIP or video conferencing.
  • Assured Forwarding (AF): AF ensures that packets are delivered with high reliability by assigning different levels of delivery assurance. There are multiple AF classes, each offering varying levels of priority and drop precedence.
  • Class Selector PHBs: These PHBs allow backward compatibility with older QoS mechanisms, such as IP Precedence, by mapping legacy traffic into DiffServ domains.

1.3 QoS Treatment at Each Hop

Once a packet is marked with a DSCP value corresponding to a PHB, each router or network device inspects the DSCP field and applies the appropriate QoS treatment. This can involve:

  • Scheduling: Packets are scheduled for forwarding based on their PHB. For instance, EF packets might be prioritized over DF packets.
  • Queueing: Traffic is placed into queues depending on its priority. Higher-priority traffic receives better queue placement to minimize delay.
  • Policing: Traffic rates can be monitored and controlled to prevent one class of traffic from exceeding its allocated bandwidth.
  • Shaping: Network devices can delay certain packets to smooth out bursts of traffic and ensure a consistent flow rate.

2. Marking in Quality of Service (QoS)

Marking is the process of assigning a specific value to a packet’s header after it has been classified. This value identifies the Quality of Service (QoS) treatment that the packet should receive as it moves through the network. Marking ensures that network devices recognize the importance of a packet and apply the appropriate forwarding behaviors, such as prioritization, rate limiting, or specific queuing mechanisms.

2.1 Importance of Marking

Marking is essential because it allows routers and switches in a network to differentiate between various types of traffic. By marking packets, the network can provide appropriate levels of service based on traffic type, ensuring that critical traffic (like voice or video) gets preferential treatment over less critical traffic (like web browsing or file downloads).

2.2 Differentiated Services Code Point (DSCP)

In IP networks, marking is usually done using the Differentiated Services Code Point (DSCP) field in the IP header. The DSCP field is a 6-bit value within the larger 8-bit Differentiated Services (DS) field of an IP packet, and it specifies the forwarding behavior (PHB) a packet should receive.

  • DSCP values: The 6-bit DSCP value defines up to 64 different forwarding classes, which are grouped into categories like Expedited Forwarding (EF), Assured Forwarding (AF), and Default Forwarding (DF).
  • Backward compatibility: The DSCP field replaces the older IP Precedence field while maintaining backward compatibility, ensuring that legacy devices can still interpret the packet marking.

2.3 Common Marking Techniques

There are various techniques to mark packets based on their QoS requirements:

  • Layer 2 Marking (802.1p): At the data link layer, Ethernet frames can be marked using the 802.1p priority field, which is a 3-bit value embedded in the 802.1Q VLAN tag. This value indicates priority at Layer 2.
  • Layer 3 Marking (DSCP/IP Precedence): At the network layer, IP packets can be marked using DSCP (as described earlier) or IP Precedence (an older mechanism).
  • Multiprotocol Label Switching (MPLS) Marking: In MPLS networks, marking can occur using the MPLS EXP field (also known as Class of Service bits), which defines the packet's priority level.

2.4 The Role of Marking in PHB

Once a packet is marked with a specific DSCP value, each hop in the network reads this value and applies the corresponding PHB. This ensures that the packet receives the correct level of service throughout its journey across the network.

  • Expedited Forwarding (EF): Marked packets with DSCP values corresponding to EF are given priority treatment to minimize latency.
  • Assured Forwarding (AF): AF-marked packets are guaranteed a minimum level of bandwidth, but may be dropped during network congestion.
  • Default Forwarding (DF): Packets without specific marking (DSCP 0) are treated as best-effort traffic, with no special priority.

3. Queuing in Quality of Service (QoS)

Queuing is a key mechanism in Quality of Service (QoS) that determines how packets are stored and processed in a network device when there is congestion. It allows the network to prioritize certain traffic types, ensuring that high-priority packets are forwarded first, while lower-priority packets are delayed or dropped when necessary.

3.1 Purpose of Queuing

The primary purpose of queuing is to manage network congestion and ensure that critical traffic (like voice, video, or interactive services) is delivered with minimal delay, jitter, and packet loss. Queuing temporarily stores packets in different queues, and the order in which packets are processed is determined by their priority level.

3.2 Types of Queuing Mechanisms

Different queuing mechanisms exist to handle traffic in varying ways. The most common types are:

  • First In, First Out (FIFO): In FIFO queuing, packets are processed in the order they arrive, with no differentiation based on priority. This method is simple but does not offer any QoS guarantees.
  • Priority Queuing (PQ): PQ allows packets to be placed in different queues based on priority. High-priority packets are processed before lower-priority packets. This method ensures that important traffic is sent first but can lead to starvation of low-priority traffic.
  • Weighted Fair Queuing (WFQ): WFQ assigns different weights to different traffic flows, allowing higher-priority traffic to receive more bandwidth while still ensuring that lower-priority traffic gets some bandwidth. This method is fairer than PQ but more complex to implement.
  • Class-Based Weighted Fair Queuing (CBWFQ): This is an extension of WFQ that allows traffic to be classified into different classes, each with a guaranteed minimum amount of bandwidth. This ensures that traffic within certain classes always gets the bandwidth it needs.
  • Low Latency Queuing (LLQ): LLQ combines strict priority queuing with CBWFQ. It guarantees that high-priority traffic, such as voice or video, is forwarded immediately, while ensuring that lower-priority traffic still receives its share of bandwidth.

3.3 How Queuing Works

When network devices experience congestion, packets are placed into different queues based on their priority or traffic class. The device's scheduler then determines which queue to service based on the queuing algorithm being used. Packets are dequeued and forwarded according to their queue's priority or weight.

  • High-priority traffic (e.g., voice) may be placed in a priority queue, ensuring immediate forwarding.
  • Lower-priority traffic (e.g., email or web traffic) may be placed in a lower-priority queue, where it may be delayed or dropped if congestion persists.

3.4 Queuing and Latency Control

Queuing mechanisms directly affect the latency, jitter, and packet loss experienced by traffic. By applying different queuing techniques, the network can ensure that time-sensitive applications like voice or video are given priority treatment, while less-sensitive traffic is managed in the background.

  • Low latency: Achieved by prioritizing real-time traffic through mechanisms like LLQ, which minimizes delay.
  • Controlled jitter: By ensuring consistent queuing for high-priority traffic, jitter can be minimized, leading to better performance for interactive services.
  • Packet loss management: Queuing mechanisms can drop packets from lower-priority queues during congestion to ensure that critical traffic flows smoothly.

4. Congestion in Quality of Service (QoS)

Congestion in a network occurs when the demand for bandwidth exceeds the available capacity, leading to packet loss, increased latency, and degraded performance. QoS mechanisms, such as queuing, traffic shaping, and congestion control techniques, are essential for managing congestion and ensuring that high-priority traffic is not negatively affected by traffic overloads.

4.1 Causes of Congestion

Congestion arises from several factors, including:

  • Insufficient Bandwidth: When the total volume of data exceeds the available bandwidth, network devices cannot forward packets as quickly as they arrive.
  • Bursty Traffic: Sudden spikes in traffic, such as file transfers or streaming media, can overwhelm network links.
  • Queue Overflow: When buffers in routers or switches become full, packets are dropped or delayed, leading to congestion.

4.2 Effects of Congestion

Congestion can degrade the performance of both critical and non-critical traffic. The common effects include:

  • Increased Latency: As packets wait in queues to be processed, the time they spend in the network increases, leading to higher latency.
  • Jitter: Fluctuations in packet delay can occur due to varying queue lengths, causing inconsistent delivery times for packets, especially affecting real-time applications like voice and video.
  • Packet Loss: When buffers overflow due to excessive traffic, packets are dropped, which can reduce the quality of data transmission and require retransmission.

4.3 Congestion Control Mechanisms

To manage and mitigate congestion, networks use a variety of congestion control mechanisms:

  • Traffic Policing: Traffic policing controls the rate at which packets are allowed into the network. If the incoming rate exceeds a preconfigured limit, excess packets are either dropped or marked for lower priority.
  • Traffic Shaping: Traffic shaping smooths out traffic bursts by delaying packets to ensure that traffic is transmitted at a consistent rate, preventing sudden spikes from overwhelming the network.
  • Random Early Detection (RED): RED is a proactive congestion avoidance technique that randomly drops packets before the network becomes fully congested, encouraging TCP connections to slow down before queues overflow.
  • Weighted Random Early Detection (WRED): WRED extends RED by applying different drop probabilities to different traffic classes, allowing higher-priority traffic to experience fewer drops during congestion.
  • Explicit Congestion Notification (ECN): ECN marks packets instead of dropping them when congestion is detected. This notifies the sending device to reduce its transmission rate, avoiding packet loss while still managing congestion.

4.4 Congestion and QoS

QoS mechanisms work in conjunction with congestion control techniques to ensure that critical traffic is handled appropriately during times of congestion. Some common approaches include:

  • Queuing: Queuing mechanisms, such as LLQ or CBWFQ, ensure that high-priority traffic is processed first, reducing its impact from congestion.
  • Prioritization: By marking and prioritizing traffic using DSCP or other marking schemes, networks can ensure that important traffic is less likely to be dropped or delayed during congestion.
  • Bandwidth Allocation: Ensuring sufficient bandwidth for key applications helps prevent congestion and maintains the performance of critical traffic.

5. Policing in Quality of Service (QoS)

Policing is a QoS mechanism used to control the rate of traffic entering a network. It ensures that traffic adheres to predefined bandwidth limits by monitoring the flow of packets and taking action if the traffic exceeds the allowed rate. These actions can include dropping packets or marking them for lower priority, thus preventing excessive traffic from overwhelming the network.

5.1 Purpose of Policing

The main goal of policing is to prevent individual flows or classes of traffic from consuming more than their allocated share of bandwidth. By enforcing rate limits, policing helps maintain network fairness and ensures that resources are shared efficiently among multiple users or applications.

5.2 How Policing Works

Policing mechanisms typically operate at the ingress point of a network device, monitoring incoming traffic flows. If the traffic exceeds the configured rate limit, the policing mechanism takes corrective actions. This is often controlled by two parameters:

  • Committed Information Rate (CIR): The maximum average rate at which packets are allowed into the network over a period of time.
  • Burst Size: The maximum number of packets that are allowed to exceed the CIR within a short time window. After this burst size is exceeded, excess traffic is penalized.

5.3 Policing Actions

When traffic exceeds the configured limits, policing can take one of the following actions:

  • Dropping Packets: Excess packets that exceed the CIR or burst limit are dropped, preventing them from being forwarded through the network. This action ensures that the traffic load stays within allowable limits.
  • Marking Packets: Instead of dropping packets, some policing mechanisms mark the excess packets with a lower priority. Marked packets can then be handled differently, such as being dropped during congestion, but still transmitted when the network is not congested.

5.4 Two-Rate Three-Color Marking (TRTCM)

TRTCM is a common policing algorithm used to classify traffic into three categories (colors) based on two rates:

  • Green: Packets within the Committed Information Rate (CIR) are marked green and are forwarded with high priority.
  • Yellow: Packets between the CIR and Peak Information Rate (PIR) are marked yellow, indicating they may be dropped during congestion.
  • Red: Packets exceeding the PIR are marked red and are likely to be dropped immediately.

5.5 Policing vs. Shaping

Policing and traffic shaping are often confused, but they differ in how they manage traffic:

  • Policing: Enforces strict rate limits by dropping or marking excess traffic. It does not attempt to smooth traffic, only restrict it.
  • Shaping: Delays excess traffic to conform to a smoother rate, preventing bursts but allowing all traffic to be transmitted eventually, rather than dropping it.

Policing is more suitable for controlling traffic at network boundaries or ingress points, while shaping is often used for smoothing traffic internally within the network.

5.6 Policing in Congestion Management

Policing helps in congestion management by preventing excessive traffic from consuming more than its fair share of network resources. By enforcing limits on certain types of traffic, policing ensures that congestion is minimized and critical traffic receives adequate bandwidth.

6. Traffic Shaping in Quality of Service (QoS)

Traffic shaping, also known as packet shaping, is a QoS mechanism used to control the rate at which data is transmitted across a network. It smooths out traffic bursts by temporarily holding packets in a buffer and releasing them at a steady, controlled rate. This ensures that the traffic conforms to predefined bandwidth limits, thereby preventing network congestion and ensuring efficient resource utilization.

6.1 Purpose of Traffic Shaping

The primary goal of traffic shaping is to regulate traffic flow to match the available network capacity. It helps prevent network congestion by smoothing out bursts in traffic, ensuring that all traffic flows at a steady, predictable rate. This improves network performance, reduces packet loss, and minimizes delays, especially for time-sensitive applications.

6.2 How Traffic Shaping Works

Traffic shaping works by buffering packets that exceed a certain transmission rate and releasing them gradually. This creates a more consistent flow of data over time. Two key parameters define traffic shaping:

  • Committed Information Rate (CIR): The maximum average rate at which traffic is allowed to be sent.
  • Burst Size: The maximum amount of traffic that can be sent in a burst above the CIR. Traffic that exceeds this limit is delayed and queued.

Shaping algorithms continuously monitor the transmission rate and use a buffer to hold excess packets until they can be transmitted without exceeding the CIR.

6.3 Traffic Shaping vs. Policing

Although both traffic shaping and policing enforce traffic limits, they differ significantly in how they handle excess traffic:

  • Traffic Shaping: Delays excess traffic by queuing it until it can be transmitted at the desired rate, allowing smoother traffic flow over time.
  • Traffic Policing: Enforces strict rate limits by either dropping or marking excess traffic without queuing it, potentially causing packet loss if the limit is exceeded.

Traffic shaping is ideal for managing traffic flows that need to be smoothed out over time, while policing is more suitable for enforcing hard rate limits at network boundaries.

6.4 Types of Traffic Shaping Algorithms

Several algorithms are used for traffic shaping, each with its unique approach:

  • Token Bucket: In this algorithm, tokens are added to a "bucket" at a fixed rate (CIR). Each token represents the permission to transmit a certain number of bytes. Packets can only be transmitted if there are enough tokens in the bucket. Excess packets are buffered until enough tokens are available.
  • Leaky Bucket: This algorithm enforces a steady flow of traffic by allowing data to be transmitted at a constant rate, regardless of incoming bursts. Any excess data beyond this rate is buffered or dropped.
  • Hierarchical Token Bucket (HTB): HTB allows for complex hierarchical traffic shaping, where multiple classes of traffic are shaped independently, providing more granular control over bandwidth allocation for different types of traffic.

6.5 Benefits of Traffic Shaping

Traffic shaping provides several benefits, especially in congested networks or for time-sensitive traffic:

  • Smooth Traffic Flow: Shaping prevents sudden bursts of traffic, ensuring a consistent and predictable rate of packet transmission.
  • Reduced Latency and Jitter: By controlling the rate of packet transmission, traffic shaping helps reduce delays and variation in packet delivery times, which is crucial for real-time applications like voice and video.
  • Improved Bandwidth Utilization: Shaping ensures that bandwidth is used efficiently without overloading the network, preventing packet loss and maximizing throughput.

6.6 Use of Traffic Shaping in Congestion Control

Traffic shaping plays a critical role in congestion control by ensuring that traffic flows smoothly without exceeding network capacity. By regulating traffic at the source (ingress shaping), it prevents excessive traffic from contributing to network congestion, ensuring that all traffic receives fair and adequate bandwidth.

  • Real-time applications, like video conferencing and VoIP, benefit from traffic shaping, as it minimizes jitter and latency, ensuring high-quality transmissions.
  • File transfers and bulk data are shaped to prevent them from overwhelming the network, allowing other, more sensitive traffic to flow uninterrupted.