I have a small engineering network with a Linux router, LAN nodes on the one side of the router, and a WAN link attached to the router. The WAN link is a 16mbit/s wireless channel, while the LAN nodes have 100mbit/s fast ethernet connections. The LAN nodes generate traffic, including commands and data. Commands are small packets (hundreds bytes) with 10-15 pps rate with a real-time need. Data is the other type with a few Mbps rate.
What I'm trying to do is to share the WAN link in a best way: high priority packets (commands) should occupy the WAN first, then everything else for other data.
So after I have read a lot of docs across the Internet I realized to organize kind of traffic management on the Linux router using tc
and HFSC Scheduling
in particular.
Now I think about next simple config:
# eth0 is the WAN link
tc qdisc add dev eth0 root handle 1:0 hfsc default 20
# Define overall bandwidth
tc class add dev eth0 parent 1:0 classid 1:1 hfsc sc rate 16mbit ul rate 16mbit
# This class is for commands
tc class add dev eth0 parent 1:1 classid 1:10 hfsc rt m2 16mbit
# And this one is for everything else
tc class add dev eth0 parent 1:1 classid 1:20 hfsc ls m2 16mbit ul m2 16mbit
And a filtering part:
# This is for commands
tc filter add dev eth0 parent 1: protocol ip prio 1 u32 match ip dst 224.0.0.0/4 flowid 1:20
# This is for everything else
tc filter add dev eth0 parent 1: protocol ip prio 2 u32 match ip dst 0.0.0.0/0 flowid 1:10
And some tuning with SFQ
as queue inside each class:
# tc qdisc add dev eth0 parent 1:10 handle 10: sfq perturb 10
# tc qdisc add dev eth0 parent 1:20 handle 20: sfq perturb 10
So using this config I expect that packets with commands should be processed as fast as possible with minimum delay. Is this config fine and complete or totally wrong?
Unfortunately I can't test this config on a production network before I'm sure that it will work.