TODO : Check prio because I think not working
When you have a link that's 100% used and you want to do something interactive (telnet), the response time can be very bad. So I want to give the telnet traffic a higher priority.
To test it, I generate tcp traffic to fullfill the total bandwidth and I start a ping. I don't know it's a good indication, but that's the best I found.
The prio qdisc has 3 builtin bands. First everything will be send from the first band and this is all non-tcp traffic (so the pings). All the tcp packets are send secondly.
RATE_TOT=100kbps IP=kriek DEV="dev eth0" OPTION="allot 1514 maxburst 20 avpkt 1000" tc qdisc del $DEV root tc qdisc add $DEV root handle 10: cbq bandwidth 10mbit avpkt 1000 tc class add $DEV parent 10:0 classid 10:1 cbq bandwidth 10mbit rate $RATE_TOT $OPTION prio 3 bounded isolated tc qdisc add $DEV parent 10:1 handle 20: prio tc filter add $DEV parent 10: protocol ip prio 3 handle 1 fw classid 10:1 tc filter add $DEV parent 10: protocol ip prio 3 handle 2 fw classid 10:1 tc filter add $DEV parent 20: protocol ip prio 3 handle 1 fw classid 20:1 tc filter add $DEV parent 20: protocol ip prio 3 handle 2 fw classid 20:3 iptables -F iptables -X iptables -N acc_0 iptables -N acc_1 iptables -A OUTPUT -t mangle -p ! tcp -j MARK --set-mark 1 iptables -A OUTPUT -t mangle -p tcp -j MARK --set-mark 2 iptables -A OUTPUT -p ! tcp -j acc_0 iptables -A OUTPUT -p tcp -j acc_1
In my second tests, I use CBQ to make two classes. One for the tcp traffic and one for the rest.
Used script (download) I also tried all possible combinations of the prio parameter, but the results didn't change.
I generated traffic and started 10 pings to measure the response time. These are the results :
|CBQ With qdisc||11.4 ms|
|CBQ With NO qdisc 20:||207.1 ms|
|PRIO : ping in band 1, rest in band 1||268.9 ms|
|PRIO : ping in band 1, rest in band 3||18.3 ms|
|PRIO : ping in band 1, rest in band 5||18.9 ms|
|PRIO : ping in band 3, rest in band 1 (X)||83 s|
10 packets transmitted, 5 packets received, 50% packet loss
round-trip min/avg/max = 23233.2/83230.2/143223.3 ms
I adapted the script so I can give more priority to telnet traffic on port 23. Of course you can't prove this with numbers, but it was clear that I had a much faster response with the prio qdisc. Same with the cbq script.
adapted prio script:
Used script (download)
adapted CBQ script:
Used script (download)