HTB&IMQ

Linux Advanced Routing and Traffic Control

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

 



i'm trying to limit upload and download but something is wrong(it is about NAT)

i will post here my "script" maybe someone could tell me what is wrong
my kernel(2.6.9) is patch with imq(linuximq.net) and my iptables(1.2.11) also



#flush 

tc qdisc del dev eth0 root 
tc qdisc del dev eth1 root 
tc qdisc del dev imq0 root 
tc qdisc del dev imq1 root 
ifconfig imq0 down 
ifconfig imq1 down 
iptables -t mangle -F 



#UPLOAD 

ifconfig imq0 up 
tc qdisc del dev imq0 root 
tc qdisc add dev imq0 root handle 1 htb default 99 
tc class add dev imq0 parent 1: classid 1:10 htb rate 1536kbit 

# 8k max 15k 
tc class add dev imq0 parent 1:10 classid 1:1020 htb rate 64Kbit ceil 120Kbit 
tc qdisc add dev imq0 parent 1:1020 handle 1020 sfq 
tc filter add dev imq0 parent 1:0 protocol ip prio 200 handle 1020 fw
classid 1:1020

#8k max 1536k  SSH 
tc class add dev imq0 parent 1:10 classid 1:1000 htb rate 120Kbit ceil 1536Kbit 
tc qdisc add dev imq0 parent 1:1000 handle 1000 sfq 
tc filter add dev imq0 parent 1:0 protocol ip prio 200 handle 1000 fw
classid 1:1000


#DOWNLOAD 

ifconfig imq1 up 
tc qdisc del dev imq1 root 
tc qdisc add dev imq1 root handle 1 htb default 98 
tc class add dev imq1 parent 1: classid 1:20 htb rate 1536kbit 

# 8k max 192k 
tc class add dev imq1 parent 1:20 classid 1:2000 htb rate 64Kbit ceil 1536Kbit 
tc qdisc add dev imq1 parent 1:2000 handle 2000 sfq 
tc filter add dev imq1 parent 1:0 protocol ip prio 200 handle 2000 fw
classid 1:2000


# 8k max 128k 
tc class add dev imq1 parent 1:20 classid 1:2010 htb rate 64Kbit ceil 1024Kbit 
tc qdisc add dev imq1 parent 1:2010 handle 2010 sfq 
tc filter add dev imq1 parent 1:0 protocol ip prio 200 handle 2010 fw
classid 1:2010


# 8k max 80k 
tc class add dev imq1 parent 1:20 classid 1:2020 htb rate 64Kbit ceil 640Kbit 
tc qdisc add dev imq1 parent 1:2020 handle 2020 sfq 
tc filter add dev imq1 parent 1:0 protocol ip prio 200 handle 2020 fw
classid 1:2020


# IP 192.168.50.0/24 


#DOWNLOAD 

#192K mark 2000 
#iptables -t mangle -A POSTROUTING -d 192.168.50.40 -j MARK --set-mark 2000 

#128k mark 2010 
iptables -t mangle -A POSTROUTING -d 192.168.50.40 -j MARK --set-mark 2010 

#64k mark 2020 
iptables -t mangle -A POSTROUTING -d 192.168.50.36 -j MARK --set-mark 2020 

#UPLOAD 
#15k mark 1020 

iptables -t mangle -A PREROUTING -s 192.168.50.40 -j MARK --set-mark 1020 
iptables -t mangle -A PREROUTING -s 192.168.50.36 -j MARK --set-mark 1020 


#imq 

iptables -t mangle -A PREROUTING -i eth0 -j IMQ --todev 0 
iptables -t mangle -A PREROUTING -i eth1 -j IMQ --todev 0 

iptables -t mangle -A POSTROUTING -o eth0 -j IMQ --todev 1 
iptables -t mangle -A POSTROUTING -o eth1 -j IMQ --todev 1 


my ifconfig imq1,imq0 show tx and rx traffic , but upload and download
shaping is not ok.

please help me
10x
_______________________________________________
LARTC mailing list / LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

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