1

I am trying to emulate traffic among multiple virtual machines. Each connection is supposed to have different parameters, i.e. delay. Therefore, I am trying to create different qdisc filters for different links because this way I can easily append a delay to each qdisc. Only I realised I cannot add more than 16 qdiscs with tc.
Is there a way to add more than 16 qdiscs? Can I maybe create another handle, handle 2?

Moreover, my commands do not work for the 10th qdisc I am adding: the connection with handle 10 (192.168.0.105 to 192.168.0.102). This connection appears to use qdisc rule with handle 20 since I measure a delay slightly above 30ms.

Here are the commands executed in the bash:

/sbin/tc  qdisc add dev eth1 root handle 1: prio bands 11  
/sbin/tc  qdisc add dev eth1 parent 1:1 handle 10: netem  delay 200ms
/sbin/tc  qdisc add dev eth1 parent 1:2 handle 20: netem  delay 30ms
/sbin/tc  qdisc add dev eth1 parent 1:3 handle 30: netem  delay 300ms
/sbin/tc  qdisc add dev eth1 parent 1:4 handle 40: netem  delay 70ms
/sbin/tc  qdisc add dev eth1 parent 1:5 handle 50: netem  delay 80ms
/sbin/tc  qdisc add dev eth1 parent 1:6 handle 60: netem  delay 90ms
/sbin/tc  qdisc add dev eth1 parent 1:7 handle 70: netem  delay 110ms
/sbin/tc  qdisc add dev eth1 parent 1:8 handle 80: netem  delay 400ms
/sbin/tc  qdisc add dev eth1 parent 1:9 handle 90: netem  delay 110ms
/sbin/tc  qdisc add dev eth1 parent 1:a handle 100: netem  delay 250ms

/sbin/tc  filter add dev eth1 protocol ip parent 1:0 prio 1 u32  match ip dst 192.168.0.101/32 match ip src 192.168.0.102/32 flowid 10:1
/sbin/tc  filter add dev eth1 protocol ip parent 1:0 prio 2 u32  match ip dst 192.168.0.101/32 match ip src 192.168.0.103/32 flowid 20:2
/sbin/tc  filter add dev eth1 protocol ip parent 1:0 prio 3 u32  match ip dst 192.168.0.101/32 match ip src 192.168.0.104/32 flowid 30:3
/sbin/tc  filter add dev eth1 protocol ip parent 1:0 prio 4 u32  match ip dst 192.168.0.101/32 match ip src 192.168.0.105/32 flowid 40:4
/sbin/tc  filter add dev eth1 protocol ip parent 1:0 prio 5 u32  match ip dst 192.168.0.101/32 match ip src 192.168.0.106/32 flowid 50:5
/sbin/tc  filter add dev eth1 protocol ip parent 1:0 prio 6 u32  match ip dst 192.168.0.101/32 match ip src 192.168.0.108/32 flowid 60:6
/sbin/tc  filter add dev eth1 protocol ip parent 1:0 prio 7 u32  match ip dst 192.168.0.101/32 match ip src 192.168.0.109/32 flowid 70:7
/sbin/tc  filter add dev eth1 protocol ip parent 1:0 prio 8 u32  match ip dst 192.168.0.102/32 match ip src 192.168.0.103/32 flowid 80:8
/sbin/tc  filter add dev eth1 protocol ip parent 1:0 prio 9 u32  match ip dst 192.168.0.102/32 match ip src 192.168.0.104/32 flowid 90:9
/sbin/tc  filter add dev eth1 protocol ip parent 1:0 prio a u32  match ip dst 192.168.0.102/32 match ip src 192.168.0.105/32 flowid 100:a
/sbin/tc  qdisc add dev eth1 parent 1:b handle 110:  pfifo
/sbin/tc  filter add dev eth1 protocol ip parent 1:0 prio b u32 match ip src 0.0.0.0/0 match ip dst 0.0.0.0/0 flowid 110:b  

I am working on Ubuntu 16.04.6 LTS.

0
1

I know this is late, but I ran into the same issue and I solved it by using htb and tc classes.

Try this:

tc qdisc add dev eth0 root handle 1: htb

tc class add dev eth0 parent 1: classid 1:1 htb rate 100mbit
tc filter add dev eth0 parent 1: protocol ip prio 1 u32 flowid 1:1 match ip dst 192.168.0.101/32 match ip src 192.168.0.102/32
tc qdisc add dev eth0 parent 1:1 handle 10: netem delay 200ms

tc class add dev eth0 parent 1: classid 1:2 htb rate 100mbit
tc filter add dev eth0 parent 1: protocol ip prio 2 u32 flowid 1:2 match ip dst 192.168.0.101/32 match ip src 192.168.0.103/32
tc qdisc add dev eth0 parent 1:2 handle 20: netem delay 30ms

and so on...

I believe this will allow you to create 9,999 different rules, though I have never tried that many myself.

I hope this helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.