Hello all

I want to implement rate control for VOIP testing. So I have configured Linux PC as a router with netem installed and having two interface cards.

device1----> Linux router with netem ---> device2

device1 connects to eth0 and device2 connects to eth1 of the Linux router. eth0 is configured to connect to the internet and eth1 has a static IP address on a local network. I want to limit bandwidth on devices connected to eth0.

So I applied the below rules using tc and tbf.

tc qdisc add dev eth0 root handle 1: prio
tc qdisc add dev eth0 parent 1:3 handle 30: netem
tc qdisc add dev eth0 parent 30:1 tbf rate 256kbit buffer 1600 limit 3000

Will the above work or should I use htb instead. I want to simulate the network conditions using different bandwidths.

tc qdisc add dev eth0 root handle 1: htb
tc class add dev eth0 parent 1: classid 1:1 htb rate 1024kbps
tc class add dev eth0 parent 1:1 classid 1:5 htb rate 512kbps ceil 640kbps prio 1
tc class add dev eth0 parent 1:1 classid 1:6 htb rate 100kbps ceil 160kbps prio 0
tc filter add dev eth0 parent 1:0 prio 1 protocol ip handle 5 fw flowid 1:5
tc filter add dev eth0 parent 1:0 prio 0 protocol ip handle 6 fw flowid 1:6

What is the best way of doing this?

Thanks