1

I have a Ubuntu Router with 2 network interfaces. eth0 is the private network and eth1 is the internet. What I want is the following: All packages (mostly udp) comming from a specified private ip (e.g. 192.168.0.4) to a given destination port (e.g. 5200) should be delayed by 500ms.

I tried several things including this, this and this. The only result is, no delay is added.

If possible I want to decide using iptables which packages should be delayed.

Here are some of the errors I got:

root@ubuntu:~# tc qdisc del dev eth1 root
root@ubuntu:~# tc qdisc ls dev eth1
qdisc pfifo_fast 0: root refcnt 2 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
root@ubuntu:~# tc qdisc add dev eth1 root handle 1: htb default 20
root@ubuntu:~# tc class add dev eth1 parent 1: classid 1:1 pfifo_fast
Error: Qdisc "pfifo_fast" is classless.
root@ubuntu:~# tc class add dev eth1 parent 1: classid 1:1 prio
Error: Qdisc "prio" is classless.
root@ubuntu:~# tc class add dev eth1 parent 1: classid 1:10 netem delay 500ms
Error: Qdisc "netem" is classless.
root@ubuntu:~# tc class add dev eth1 parent 1:10 netem delay 500ms
Error: Qdisc "netem" is classless.

What am I doing wrong?

2

you are trying to apply 'netem' to a class, not a qdisc.

Basic idea is that you have to create the root qdisc, (as you have done) apply a class to that, which can have child classes, these child classes must have the same traffic method as the parent, (in this case htb). those leaf classes then may have a qdisc applied to them, and it is there that you would specify netem (or pfifo_fast, or other classful or classless forms) and its settings.

(or, if you want to be global about it, you can apply netem to the root qdisc without using a class, (hence '"netem" is classless'))

root qdisc --> inner (parent) class --> leaf (child) class --> qdisc

here's some old tc doc that I found pretty clear, though netem was not apparently an option when that was written or updated.

| improve this answer | |
  • Thanks so much for this answer. To help you keep up the good work, I accepted your answer! – rollstuhlfahrer Nov 3 '17 at 11:49

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.