Implement enterprise network QoS with Cisco integration using FRRouting and traffic shaping

Advanced 45 min Jun 13, 2026 19 views
Ubuntu 24.04 Debian 12 AlmaLinux 9 Rocky Linux 9

Configure enterprise-grade Quality of Service policies with DSCP marking, traffic shaping using tc and HTB, and seamless integration with Cisco equipment through FRRouting BGP and OSPF routing protocols for comprehensive network bandwidth management.

Prerequisites

  • Root access to Linux servers
  • Basic networking knowledge
  • Existing Cisco infrastructure
  • Multiple network interfaces

What this solves

Enterprise networks require sophisticated Quality of Service (QoS) policies to prioritize critical traffic and maintain performance across diverse applications. This tutorial configures advanced QoS with DSCP marking, hierarchical traffic shaping, and seamless integration with Cisco infrastructure through FRRouting's BGP and OSPF implementations.

Prerequisites

You need root access to your Linux servers, basic understanding of networking concepts, and existing network infrastructure with Cisco equipment. Your servers should have multiple network interfaces for testing traffic separation.

Step-by-step configuration

Install FRRouting and traffic control tools

Install FRRouting for Cisco protocol compatibility and Linux traffic control utilities for QoS implementation.

curl -s https://deb.frrouting.org/frr/keys.asc | sudo apt-key add -
echo 'deb https://deb.frrouting.org/frr jammy frr-stable' | sudo tee /etc/apt/sources.list.d/frr.list
sudo apt update
sudo apt install -y frr frr-pythontools iproute2 tc iptables-persistent
sudo dnf install -y epel-release
sudo dnf install -y https://rpm.frrouting.org/repo/rpm-repo-0-*.noarch.rpm
sudo dnf install -y frr iproute tc iptables-services
sudo systemctl enable iptables

Enable FRRouting daemons

Configure FRRouting to enable BGP and OSPF daemons for Cisco integration.

bgpd=yes
ospfd=yes
zebra=yes
vtysh_enable=yes
zebra_options="  -A 127.0.0.1 -s 90000000"
bgpd_options="   -A 127.0.0.1"
ospfd_options="  -A 127.0.0.1"

Configure FRRouting BGP for Cisco integration

Set up BGP peering with Cisco equipment and implement route policies for QoS integration.

frr version 8.4
frr defaults traditional
hostname frrouting-qos
log syslog informational
ipv6 forwarding
!
interface eth0
 description WAN-Interface
 ip address 203.0.113.10/24
!
interface eth1
 description LAN-Interface
 ip address 192.168.1.1/24
!
router bgp 65001
 bgp router-id 203.0.113.10
 neighbor 203.0.113.1 remote-as 65000
 neighbor 203.0.113.1 description Cisco-BGP-Peer
 !
 address-family ipv4 unicast
  neighbor 203.0.113.1 activate
  neighbor 203.0.113.1 route-map QOS-OUT out
  neighbor 203.0.113.1 route-map QOS-IN in
 exit-address-family
!
router ospf
 ospf router-id 192.168.1.1
 network 192.168.1.0/24 area 0
 network 203.0.113.0/24 area 0
!
route-map QOS-OUT permit 10
 set community 65001:100
 set ip next-hop unchanged
!
route-map QOS-IN permit 10
 match community PRIORITY-TRAFFIC
 set local-preference 200
!
ip community-list standard PRIORITY-TRAFFIC permit 65000:100
!
line vty
!

Start and enable FRRouting services

Enable FRRouting services and verify BGP neighbor establishment.

sudo systemctl enable --now frr
sudo systemctl status frr
sudo vtysh -c "show ip bgp summary"
sudo vtysh -c "show ip ospf neighbor"

Configure DSCP marking with iptables

Implement DSCP marking for traffic classification and QoS policy enforcement.

# DSCP marking for enterprise QoS
*mangle
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]

Voice traffic - EF (Expedited Forwarding) DSCP 46

-A POSTROUTING -p udp --dport 5060:5090 -j DSCP --set-dscp 46 -A POSTROUTING -p tcp --dport 5060:5090 -j DSCP --set-dscp 46 -A POSTROUTING -p udp --dport 16384:32767 -j DSCP --set-dscp 46

Video conferencing - AF41 DSCP 34

-A POSTROUTING -p tcp --dport 443 -m string --string "zoom" --algo bm -j DSCP --set-dscp 34 -A POSTROUTING -p udp --dport 8801:8810 -j DSCP --set-dscp 34 -A POSTROUTING -p tcp --dport 1935 -j DSCP --set-dscp 34

Database traffic - AF31 DSCP 26

-A POSTROUTING -p tcp --dport 3306 -j DSCP --set-dscp 26 -A POSTROUTING -p tcp --dport 5432 -j DSCP --set-dscp 26 -A POSTROUTING -p tcp --dport 1433 -j DSCP --set-dscp 26

Management traffic - CS6 DSCP 48

-A POSTROUTING -p tcp --dport 22 -j DSCP --set-dscp 48 -A POSTROUTING -p tcp --dport 161:162 -j DSCP --set-dscp 48 -A POSTROUTING -p tcp --dport 179 -j DSCP --set-dscp 48

Web traffic - AF21 DSCP 18

-A POSTROUTING -p tcp --dport 80 -j DSCP --set-dscp 18 -A POSTROUTING -p tcp --dport 443 -j DSCP --set-dscp 18

Best effort - default DSCP 0

-A POSTROUTING -j DSCP --set-dscp 0 COMMIT *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] COMMIT

Apply iptables rules

Load the DSCP marking rules and make them persistent across reboots.

sudo iptables-restore < /etc/iptables/rules.v4
sudo systemctl enable netfilter-persistent
sudo netfilter-persistent save
sudo iptables-restore < /etc/iptables/rules.v4
sudo service iptables save
sudo systemctl enable iptables

Configure HTB traffic shaping

Implement Hierarchical Token Bucket (HTB) for bandwidth management and traffic prioritization.

#!/bin/bash

Interface configuration

INTERFACE="eth0" BANDWIDTH="100mbit"

Clear existing qdisc

tc qdisc del dev $INTERFACE root 2>/dev/null

Create root HTB qdisc

tc qdisc add dev $INTERFACE root handle 1: htb default 60

Create root class with total bandwidth

tc class add dev $INTERFACE parent 1: classid 1:1 htb rate $BANDWIDTH

Voice traffic - 20% guaranteed, 50% max

tc class add dev $INTERFACE parent 1:1 classid 1:10 htb rate 20mbit ceil 50mbit prio 1 tc filter add dev $INTERFACE parent 1: protocol ip prio 1 u32 match ip tos 0xb8 0xfc flowid 1:10

Video traffic - 30% guaranteed, 60% max

tc class add dev $INTERFACE parent 1:1 classid 1:20 htb rate 30mbit ceil 60mbit prio 2 tc filter add dev $INTERFACE parent 1: protocol ip prio 2 u32 match ip tos 0x88 0xfc flowid 1:20

Database traffic - 15% guaranteed, 40% max

tc class add dev $INTERFACE parent 1:1 classid 1:30 htb rate 15mbit ceil 40mbit prio 3 tc filter add dev $INTERFACE parent 1: protocol ip prio 3 u32 match ip tos 0x68 0xfc flowid 1:30

Management traffic - 10% guaranteed, 30% max

tc class add dev $INTERFACE parent 1:1 classid 1:40 htb rate 10mbit ceil 30mbit prio 4 tc filter add dev $INTERFACE parent 1: protocol ip prio 4 u32 match ip tos 0xc0 0xfc flowid 1:40

Web traffic - 15% guaranteed, 50% max

tc class add dev $INTERFACE parent 1:1 classid 1:50 htb rate 15mbit ceil 50mbit prio 5 tc filter add dev $INTERFACE parent 1: protocol ip prio 5 u32 match ip tos 0x48 0xfc flowid 1:50

Best effort - 10% guaranteed, remaining available

tc class add dev $INTERFACE parent 1:1 classid 1:60 htb rate 10mbit ceil $BANDWIDTH prio 6

Add fair queuing to each class for better distribution

tc qdisc add dev $INTERFACE parent 1:10 handle 10: sfq perturb 10 tc qdisc add dev $INTERFACE parent 1:20 handle 20: sfq perturb 10 tc qdisc add dev $INTERFACE parent 1:30 handle 30: sfq perturb 10 tc qdisc add dev $INTERFACE parent 1:40 handle 40: sfq perturb 10 tc qdisc add dev $INTERFACE parent 1:50 handle 50: sfq perturb 10 tc qdisc add dev $INTERFACE parent 1:60 handle 60: sfq perturb 10 echo "QoS configuration applied successfully" tc class show dev $INTERFACE

Make QoS script executable and apply configuration

Set proper permissions and apply the traffic shaping configuration.

sudo chmod +x /usr/local/bin/setup-qos.sh
sudo /usr/local/bin/setup-qos.sh

Create systemd service for persistent QoS

Ensure QoS configuration persists across system reboots with a systemd service.

[Unit]
Description=Network QoS Configuration
After=network-online.target
Wants=network-online.target

[Service]
Type=oneshot
ExecStart=/usr/local/bin/setup-qos.sh
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Enable QoS service and configure bandwidth monitoring

Enable the QoS service and set up monitoring for traffic analysis.

sudo systemctl daemon-reload
sudo systemctl enable --now network-qos
sudo systemctl status network-qos

Configure advanced OSPF for Cisco integration

Set up OSPF areas and route redistribution for enterprise network integration. For complex QoS routing, you might also want to explore OSPF multi-area design with FRRouting for larger deployments.

sudo vtysh
configure terminal
router ospf
 area 0 authentication message-digest
 area 1 stub
 network 10.0.0.0/8 area 1
 redistribute connected metric 20 metric-type 2
 redistribute static metric 10 metric-type 1
 passive-interface default
 no passive-interface eth0
 no passive-interface eth1
 timers throttle spf 200 1000 5000
 max-metric router-lsa on-startup 60
!
interface eth0
 ip ospf message-digest-key 1 md5 cisco123
 ip ospf priority 100
 ip ospf cost 10
!
interface eth1
 ip ospf message-digest-key 1 md5 cisco123
 ip ospf priority 200
 ip ospf cost 5
!
write memory
exit

Configure traffic monitoring and QoS statistics

Set up monitoring scripts to track QoS effectiveness and bandwidth utilization.

#!/bin/bash

INTERFACE="eth0"
LOGFILE="/var/log/qos-stats.log"

echo "$(date): QoS Statistics for $INTERFACE" >> $LOGFILE
echo "===========================================" >> $LOGFILE

Display class statistics

tc -s class show dev $INTERFACE >> $LOGFILE

Display current DSCP markings

echo "\nDSCP Statistics:" >> $LOGFILE iptables -t mangle -L POSTROUTING -v -n | grep DSCP >> $LOGFILE

BGP neighbor status

echo "\nBGP Neighbor Status:" >> $LOGFILE vtysh -c "show ip bgp summary" >> $LOGFILE

OSPF neighbor status

echo "\nOSPF Neighbor Status:" >> $LOGFILE vtysh -c "show ip ospf neighbor" >> $LOGFILE echo "" >> $LOGFILE

Set up automated QoS monitoring

Create a cron job for regular QoS monitoring and performance tracking.

sudo chmod +x /usr/local/bin/qos-monitor.sh
(crontab -l 2>/dev/null; echo "/5    * /usr/local/bin/qos-monitor.sh") | sudo crontab -

Configure Cisco integration verification

Verify BGP and OSPF peering with Cisco equipment and QoS policy synchronization.

# Verify BGP neighbor establishment
sudo vtysh -c "show ip bgp neighbor 203.0.113.1"

Check OSPF database

sudo vtysh -c "show ip ospf database"

Verify route redistribution

sudo vtysh -c "show ip route ospf" sudo vtysh -c "show ip route bgp"

Verify your setup

Test the QoS configuration and verify Cisco integration with comprehensive checks.

# Check QoS class configuration
tc class show dev eth0

Verify DSCP marking rules

iptables -t mangle -L POSTROUTING -v -n

Test BGP connectivity

sudo vtysh -c "show ip bgp summary" sudo vtysh -c "show ip bgp neighbors"

Check OSPF neighbors

sudo vtysh -c "show ip ospf neighbor" sudo vtysh -c "show ip ospf interface"

Monitor traffic classification

watch -n 2 'tc -s class show dev eth0'

Test DSCP marking with ping

ping -Q 184 203.0.113.1 # Test AF21 marking ping -Q 136 203.0.113.1 # Test AF31 marking

Check routing table

ip route show sudo vtysh -c "show ip route"

Performance tuning

Optimize QoS performance for high-throughput enterprise environments.

ParameterDefaultOptimizedPurpose
HTB quantum15008000Better packet scheduling
SFQ perturb105More frequent hash regeneration
OSPF SPF throttle50001000Faster convergence
BGP keepalive6030Faster failure detection

Apply performance optimizations:

# Optimize network buffers
echo 'net.core.rmem_max = 16777216' | sudo tee -a /etc/sysctl.conf
echo 'net.core.wmem_max = 16777216' | sudo tee -a /etc/sysctl.conf
echo 'net.ipv4.tcp_rmem = 4096 65536 16777216' | sudo tee -a /etc/sysctl.conf
echo 'net.ipv4.tcp_wmem = 4096 65536 16777216' | sudo tee -a /etc/sysctl.conf

Apply changes

sudo sysctl -p

Optimize BGP timers

sudo vtysh -c "configure terminal" sudo vtysh -c "router bgp 65001" sudo vtysh -c "neighbor 203.0.113.1 timers 30 90" sudo vtysh -c "write memory"

Integration with advanced iptables QoS

For more sophisticated packet marking and filtering rules, consider implementing advanced iptables QoS with fwmark to complement your FRRouting setup.

Common issues

SymptomCauseFix
BGP neighbor won't establishFirewall blocking port 179sudo iptables -A INPUT -p tcp --dport 179 -j ACCEPT
OSPF adjacency failsArea ID mismatchVerify area configuration with show ip ospf interface
Traffic not shaped correctlyWrong interface specifiedCheck with ip link show and update script
DSCP marking not workingiptables rules not appliedsudo iptables-save | grep DSCP to verify
QoS classes emptyFilter rules not matchingUse tcpdump -i eth0 -v to check DSCP values
Route redistribution failsMetric conflictsAdjust redistribution metrics in OSPF config

Security considerations

Security note: QoS configurations can be exploited for DoS attacks. Always implement rate limiting and monitor for unusual traffic patterns.

Implement security hardening for QoS infrastructure:

# Protect against QoS abuse
iptables -A INPUT -p tcp --dport 179 -m limit --limit 10/minute -j ACCEPT
iptables -A INPUT -p tcp --dport 179 -j DROP

Monitor for DSCP abuse

echo '/10 * /usr/bin/iptables -t mangle -Z' | sudo crontab -

BGP authentication

sudo vtysh -c "configure terminal" sudo vtysh -c "router bgp 65001" sudo vtysh -c "neighbor 203.0.113.1 password CiscoQoSAuth2024" sudo vtysh -c "write memory"

Next steps

Running this in production?

Need this managed? Running enterprise QoS at scale adds complexity: capacity planning, policy optimization, multi-vendor integration, and 24/7 monitoring. Our managed platform covers monitoring, optimization and incident response for European enterprise networks.

Automated install script

Run this to automate the entire setup

Need help?

Don't want to manage this yourself?

We handle private cloud infrastructure for businesses that depend on uptime. From initial setup to ongoing operations.