help for script add ip addresses dynamically

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
 
 I am trying to write a script that will create a class and will add specific Ip address to that class.
let me write commands:
 
tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1: htb default 12
tc class add dev eth0 parent 1 classid 1:1 htb rate 10mbit ceil 10mbit
tc qdisc add dev eth0 parent 1:1 sfq
 
tc class add dev eth0 parent 1:1 classid 1:21 htb rate 128kbit ceil 128kbit
tc filter add dev eth0 parent 1: protocol ip prio 1 u32 \match ip dst 172.18.5.74 classid 1:21
 
tc class add dev eth0 parent 1:1 classid 1:22 htb rate 128kbit ceil 128kbit
tc filter add dev eth0 parent 1: protocol ip prio 1 u32 \match ip dst 193.140.57.150 classid 1:22
 
tc class add dev eth0 parent 1:1 classid 1:23 htb rate 128kbit ceil 128kbit
tc filter add dev eth0 parent 1: protocol ip prio 1 u32 \match ip dst 172.18.5.74 classid 1:23
 
tc class add dev eth0 parent 1:1 classid 1:24 htb rate 128kbit ceil 128kbit
tc filter add dev eth0 parent 1: protocol ip prio 1 u32 \match ip dst 172.18.5.74 classid 1:24
 
tc class add dev eth0 parent 1:1 classid 1:25 htb rate 128kbit ceil 128kbit
tc filter add dev eth0 parent 1: protocol ip prio 1 u32 \match ip dst 172.18.5.74 classid 1:25
 
As you see above  I create 5 cladd for 5 different Ip address and limit download traffic to 128 kbps
 
but when I check statistics below i see that only a few classes work properly. others continue to download above 128kbps even 512kbps.  is there any idea?
 
[root@fwr router]# tc -s class show dev eth0
class htb 1:22 parent 1:1 prio 0 rate 128Kbit ceil 128Kbit burst 1615b cburst 1615b
 Sent 6068801 bytes 14516 pkts (dropped 0, overlimits 0 requeues 0)
 rate 42bit
 lended: 14516 borrowed: 0 giants: 0
 tokens: 95744 ctokens: 95744
 
class htb 1:1 root rate 10Mbit ceil 10Mbit burst 2848b cburst 2848b
 Sent 25851580 bytes 28255 pkts (dropped 0, overlimits 0 requeues 0)
 rate 16072bit 11pps
 lended: 0 borrowed: 0 giants: 0
 tokens: -142 ctokens: -142
 
class htb 1:23 parent 1:1 prio 0 rate 128Kbit ceil 128Kbit burst 1615b cburst 1615b
 Sent 19799433 bytes 13750 pkts (dropped 0, overlimits 0 requeues 0)
 rate 16031bit 10pps backlog 11p
 lended: 13739 borrowed: 0 giants: 0
 tokens: -193536 ctokens: -193536
 
class htb 1:21 parent 1:1 prio 0 rate 128Kbit ceil 128Kbit burst 1615b cburst 1615b
 Sent 0 bytes 0 pkts (dropped 0, overlimits 0 requeues 0)
 lended: 0 borrowed: 0 giants: 0
 tokens: 103424 ctokens: 103424
 
class htb 1:24 parent 1:1 prio 0 rate 128Kbit ceil 128Kbit burst 1615b cburst 1615b
 Sent 0 bytes 0 pkts (dropped 0, overlimits 0 requeues 0)
 lended: 0 borrowed: 0 giants: 0
 tokens: 103424 ctokens: 103424
 
class htb 1:25 parent 1:1 prio 0 rate 128Kbit ceil 128Kbit burst 1615b cburst 1615b
 Sent 0 bytes 0 pkts (dropped 0, overlimits 0 requeues 0)
 lended: 0 borrowed: 0 giants: 0
 tokens: 103424 ctokens: 103424
 
 
Also you can see below tc filter output
[root@fwr router]# tc filter show dev eth0
filter parent 1: protocol ip pref 1 u32
filter parent 1: protocol ip pref 1 u32 fh 800: ht divisor 1
filter parent 1: protocol ip pref 1 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:21
  match ac12054a/ffffffff at 16
filter parent 1: protocol ip pref 1 u32 fh 800::801 order 2049 key ht 800 bkt 0 flowid 1:22
  match c18c3996/ffffffff at 16
filter parent 1: protocol ip pref 1 u32 fh 800::802 order 2050 key ht 800 bkt 0 flowid 1:23
  match c18c395a/ffffffff at 16
filter parent 1: protocol ip pref 1 u32 fh 800::803 order 2051 key ht 800 bkt 0 flowid 1:24
  match ac101055/ffffffff at 16
filter parent 1: protocol ip pref 1 u32 fh 800::804 order 2052 key ht 800 bkt 0 flowid 1:25
  match ac10113b/ffffffff at 16
 
Taylan KIRAN
Network&System Specialist
Koc University
 
 
_______________________________________________
LARTC mailing list
LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux