Network

Web Apps

System

Cloud

Cryptography

IoT

Exercise 22: Network Traffic Prioritization with QoS

by | Jan 22, 2025

Objective

Configure Quality of Service (QoS) to prioritize specific types of network traffic and analyze its impact on network performance.

Scenario

You are a network administrator responsible for optimizing network performance in an office where multiple devices are consuming bandwidth through video streaming, file downloads, and VoIP calls. To ensure smooth VoIP and video streaming experiences, you need to configure QoS on the router to prioritize these traffic types over non-critical services. In this exercise, you’ll implement QoS and verify its effectiveness.

⚠️ Important: This exercise should be performed in a legal and controlled lab environment. Applying network changes in a production environment without approval can disrupt services.


Lab Instructions

Step 1: Set Up the Test Environment

  • Devices:
    • Device A: Running VoIP or video streaming (e.g., Zoom, YouTube).
    • Device B: Performing large file downloads or cloud backups.
    • Router: A managed router capable of QoS configuration.
  • Monitoring Tool: Install Wireshark on Device A to analyze traffic.

Step 2: Simulate Network Congestion

On Device B, start downloading large files:

wget http://speedtest.tele2.net/1GB.zip

On Device A, begin a VoIP call or stream a video.

Observe any lag or reduced quality in the VoIP/video stream.

Step 3: Configure QoS on the Router

  • Access the router’s admin panel (e.g., 192.168.1.1).
  • Navigate to QoS Settings.

a. Prioritize VoIP/Video Streaming Traffic

  • Enable QoS.
  • Set the following priorities:
    • High Priority: VoIP traffic (e.g., ports 5060, 5061 for SIP) and streaming services.
    • Medium Priority: Web browsing.
    • Low Priority: File downloads and P2P traffic.

b. Apply Traffic Rules

Configure QoS rules:

VoIP Traffic:

Protocol: UDP 
Port Range: 5060-5061 
Priority: High

Video Streaming (e.g., YouTube):

Protocol: TCP/UDP 
Port Range: 443 
Priority: High

File Downloads:

Protocol: TCP 
Port Range: 80, 443 
Priority: Low

Save and apply the settings.

Step 4: Verify Traffic Prioritization with Wireshark

On Device A, start Wireshark and capture network traffic:

udp.port == 5060 || tcp.port == 443

Analyze packet delays and jitter for VoIP/video traffic.

Compare results before and after QoS was enabled.

Step 5: Test Network Performance Post-QoS

  • Continue large downloads on Device B.
  • Check the VoIP call or video stream on Device A.
  • Expected Result: VoIP and video should run smoothly without noticeable lag, while download speeds on Device B may be slightly reduced.

Solution & Explanation

How QoS Works

  • QoS prioritizes network traffic based on the type of service.
  • High-priority traffic (VoIP, video) gets bandwidth preference over non-critical tasks.

Impact Before QoS

  • High latency and packet loss during VoIP calls due to bandwidth congestion.
  • Streaming services buffer or lag.

Impact After QoS

  • VoIP calls and video streaming maintain quality even during network congestion.
  • File downloads are deprioritized, but complete without interruption.

Example Traffic Priority Table

Traffic TypeProtocol/PortPriority
VoIP (SIP)UDP 5060-5061High
Video StreamingTCP/UDP 443High
Web BrowsingTCP 80, 443Medium
File DownloadsTCP 80, 443Low

Testing & Verification

  • Before QoS:
    • VoIP call quality is poor during file downloads.
    • Video streaming lags or buffers.
  • After QoS:
    • VoIP and video streaming remain stable.
    • File downloads slow slightly but continue.

Security Best Practices

  1. Enable QoS: Prioritize critical services to maintain performance.
  2. Segment Network Traffic: Use VLANs to separate critical and non-critical traffic.
  3. Monitor Traffic Regularly: Use tools like Wireshark to analyze network performance.
  4. Limit Bandwidth for Non-Essential Services: Prevent bandwidth abuse.

Additional Script (Optional)

Automate QoS setup on Linux routers using tc:

#!/bin/bash
# Prioritize VoIP and video streaming traffic

# Clear existing rules
sudo tc qdisc del dev eth0 root

# Set up QoS
sudo tc qdisc add dev eth0 root handle 1: htb default 12
sudo tc class add dev eth0 parent 1: classid 1:1 htb rate 100mbit

# High priority for VoIP
sudo tc class add dev eth0 parent 1:1 classid 1:10 htb rate 50mbit ceil 100mbit
sudo tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32 match ip dport 5060 0xffff flowid 1:10

# Medium priority for web traffic
sudo tc class add dev eth0 parent 1:1 classid 1:11 htb rate 30mbit ceil 100mbit
sudo tc filter add dev eth0 protocol ip parent 1:0 prio 2 u32 match ip dport 80 0xffff flowid 1:11

# Low priority for file downloads
sudo tc class add dev eth0 parent 1:1 classid 1:12 htb rate 20mbit ceil 100mbit
sudo tc filter add dev eth0 protocol ip parent 1:0 prio 3 u32 match ip dport 21 0xffff flowid 1:12

echo "QoS configuration applied."

Conclusion

In this exercise, you configured QoS to prioritize VoIP and video streaming traffic, improving performance during network congestion. You verified the impact of QoS by analyzing traffic with Wireshark and ensuring critical services remained uninterrupted. Proper QoS configuration is essential for maintaining network efficiency and user satisfaction.

0 Comments