Traffic shaping

Linux Advanced Routing and Traffic Control

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

 



I am using HTB for traffic shaping, my scenario is 
Eth1 is my local interface and I wan to shape bandwidth for IP 172.16.173.245.
Now I want if any request from above IP comes its get 1mb speed and all others get 96kb speed, for this setup I make following script but it does not work. Can anyone help me ?
 
htb script
--------------
tc qdisc del dev eth1 root 2> /dev/null > /dev/null
tc qdisc add dev eth1 root handle 11: htb
tc class add dev eth1 parent 11: classid 11:1 htb rate 10mbit
tc class add dev eth1 parent 11:1 classid 11:21 htb rate 1024kbit ceil 1024kbit prio 5
tc qdisc add dev eth1 parent 11:21 handle 21: sfq perturb 10
tc filter add dev eth1 parent 11: protocol ip prio 100 handle 5000 fw flowid 11:21
tc class add dev eth1 parent 11:1 classid 11:22 htb rate 96kbit ceil 96kbit prio 5
tc qdisc add dev eth1 parent 11:22 handle 22: sfq perturb 10
tc filter add dev eth1 protocol ip parent 11: prio 2 u32 match ip dst 172.16.173.254 flowid 11:22

iptables -t mangle -A PREROUTING -s 172.16.173.245 -p tcp --dport 80 -j MARK --set-mark 5000


htp result
--------------
[root@test ~]# tc -s class show dev eth1

class htb 11:22 parent 11:1 leaf 22: prio 5 rate 96000bit ceil 96000bit burst 1647b cburst 1647b
 Sent 179720 bytes 247 pkt (dropped 0, overlimits 0 requeues 0)
 rate 29728bit 5pps backlog 0b 42p requeues 0
 lended: 205 borrowed: 0 giants: 0
 tokens: -141972 ctokens: -141972

class htb 11:1 root rate 10000Kbit ceil 10000Kbit burst 6600b cburst 6600b
 Sent 129540 bytes 205 pkt (dropped 0, overlimits 0 requeues 0)
 rate 56bit 0pps backlog 0b 0p requeues 0
 lended: 0 borrowed: 0 giants: 0
 tokens: 3953 ctokens: 3953

class htb 11:21 parent 11:1 leaf 21: prio 5 rate 1024Kbit ceil 1024Kbit burst 2112b cburst 2112b
 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0
 lended: 0 borrowed: 0 giants: 0
 tokens: 16500 ctokens: 16500

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
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