We are developing a client/server applications. There are three types of network data in our server app: Realtime data such as those of Video/audio, Critical Data such as those of Database data and BestEfforts data as those of common file transfer.
We plan to set the QOS field of each IP packet to indicate which data type of the above three the ip packet belongs to, then use TC to set different Maximum rates for these three types of data.
As far as I know setting qos field is viable, but I wonder if we can limit the rate of ip packets by specifying qos value (the value of QOS field in IP header).
Best Answer
I guess you mean 8-bit
TOS
field in IPv4 packet header. Have you alread read LARTC HOWTO? This is the guide you definitely need to read. Briefly, you need to1) Define
QDISCs
andCLASSes
in which traffic is classified, prioritized and shaped (egress traffic can be shaped only !!!). In general, any packet which needs to be sent is enqueued toQDISC
of network interface.Classes with lower
prio
field are tried first. So the class 1:10 may be dedicated for packets requiring e.g. minimum delay. The classes 1:11 and 1:12 have attachedSFQ
queuing discipline to ensure more fair bandwidth sharing.2) Define FILTERs to enqueue a packet to the right
CLASS
.This simply tells that a packet with mark 10 goes to class 10 and so on.
3) Define iptables rules to mark a packet to enqueue it to the right
CLASS
I use iptables
tos
module on purpose to show you how you can match specific values ofTOS
field and mark it accordingly. For more about this module run