rajendra@subisu.net.np
2006-May-28 15:57 UTC
TCNG HTB Branching the class not working. (bug or what)
Hi, I am new to traffic control in linux. However, i have able to grab many new knowledge in recent days. I find tcng somewhat easy to use (although lack proper doc. of its usage). I want to control traffic of several IP Addresses connected to my LANSIDE. What I want is , i want to separate certain bandwidth to all my clients. dev "etho" { htb() { class ( rate 400kbps, ceil 400kbps) if ip_dst == 192.168.0.9 class ( rate 400kbps, ceil 400kbps) if ip_dst == 192.168.0.10 ..... and so on for every IP. } It compiles and work well with no syntax error. However For each IP I want to prioritize the traffic. Say, priority 1 for http traffic and priority 2 for other, each host limiting within their allocated bandwidth. I tried the following configuration, and also compiled without syntax error. But it did not work. Starnge, when I looked tc files (#tcc files.tc), it generates unusal tc commnds. I guess, its a bug on tcc compiler or it happens to my box due to some misconfgurations? Please look at the following example where I have a problem [root@server traffic]# cat test1.tc #include "fields.tc" #include "ports.tc" #define LANSIDE eth0 #define WANSIDE eth1 /*######### Shape DOWNLOAD Traffic ############*/ /*#############################################*/ dev LANSIDE { htb() { //Main link bandwidth class (rate 128kbps, ceil 128kbps) { //Client 1 class (rate 128kbps, ceil 128kbps) if ip_dst =192.168.0.9 { class (prio 1, rate 128kbps, ceil 128kbps) if tcp_sport == 80; class (prio 2, rate 128kbps, ceil 128kbps) if 1; } //Client 2 class (rate 64kbps, ceil 64kbps) if ip_dst == 192.168.0.20 { class (prio 1, rate 64kbps, ceil 64kbps) if tcp_sport ==80; class (prio 2, rate 128kbps, ceil 128kbps) if 1; } } // end of root class } //End of qdiscs (HTB) } //End of device (LANSIDE) [root@server traffic]# tcc -r test1.tc tc qdisc del dev eth0 root # ================================ Device eth0 =============================== tc qdisc add dev eth0 handle 1:0 root htb tc class add dev eth0 parent 1:0 classid 1:1 htb rate 16000bps ceil 16000bps tc class add dev eth0 parent 1:1 classid 1:2 htb rate 16000bps ceil 16000bps tc class add dev eth0 parent 1:2 classid 1:3 htb rate 16000bps ceil 16000bps prio 1 tc class add dev eth0 parent 1:2 classid 1:4 htb rate 16000bps ceil 16000bps prio 2 tc class add dev eth0 parent 1:1 classid 1:5 htb rate 8000bps ceil 8000bps tc class add dev eth0 parent 1:5 classid 1:6 htb rate 8000bps ceil 8000bps prio 1 tc class add dev eth0 parent 1:5 classid 1:7 htb rate 16000bps ceil 16000bps prio 2 tc filter add dev eth0 parent 1:1 protocol all prio 1 u32 match u32 0xc0a80009 0xffffffff at 16 classid 1:2 tc filter add dev eth0 parent 1:1 protocol all prio 1 handle 1:0:0 u32 divisor 1 tc filter add dev eth0 parent 1:1 protocol all prio 1 u32 match u8 0x6 0xff at 9 offset at 0 mask 0f00 shift 6 eat link 1:0:0 tc filter add dev eth0 parent 1:1 protocol all prio 1 handle 1:0:1 u32 ht 1:0:0 match u16 0x50 0xffff at 0 classid 1:3 tc filter add dev eth0 parent 1:1 protocol all prio 1 u32 match u32 0x0 0x0 at 0 classid 1:4 SEE here we haven''t got any u32 filter for classes 1:5, 1:6 or 1:7. What is the problem? Is it a bug?? As each class has filter, defines in .tc file why tcc could not make a filter for this. One thing, I haven''t succeeded in using tcng branching the class aas above. Even a simple configuration (although it compiles). But it works if I do not branch any class. I will appreciate your help. With regds, Rajendra Adhikari Subisucable Internet Kathmandu, Nepal.