HTB and metro+int. limits

Linux Advanced Routing and Traffic Control

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

 



Hello,
I need to setup HTB to limit the bandwidth, but I need to have 2 types of
limits, because my ISP gives me more bandwith for sites located in my
country, than others located outside. I have setup the following script in
which I mark packets with mark 6 for the ip clasess for the sites in my
country. What I don't know is how to continue the script with assigning
lower limits to everything else not going from ip's in --set-mark 6.
Maybe some of can enlighten me about this.
Thanks,

Alex

#!/bin/sh
#Mark metro packets
/sbin/iptables -t mangle -A PREROUTING -i eth2 -d 213.154.152.0/24 -j
MARK --set-mark 6
/sbin/iptables -t mangle -A PREROUTING -i eth2 -d 213.154.119.0/24 -j
MARK --set-mark 6
/sbin/iptables -t mangle -A PREROUTING -i eth2 -d 213.154.117.0/24 -j
MARK --set-mark 6
/sbin/iptables -t mangle -A PREROUTING -i eth2 -d 213.154.118.0/24 -j
MARK --set-mark 6
/sbin/iptables -t mangle -A PREROUTING -i eth2 -d 213.154.116.0/24 -j
MARK --set-mark 6
/sbin/iptables -t mangle -A PREROUTING -i eth2 -d 213.154.126.0/24 -j
MARK --set-mark 6
/sbin/iptables -t mangle -A PREROUTING -i eth2 -d 213.157.176.0/24 -j
MARK --set-mark 6
/sbin/iptables -t mangle -A PREROUTING -i eth2 -d 213.157.117.0/24 -j
MARK --set-mark 6
/sbin/iptables -t mangle -A PREROUTING -i eth2 -d 213.157.126.0/24 -j
MARK --set-mark 6
/sbin/iptables -t mangle -A PREROUTING -i eth2 -d 80.97.173.0/24 -j
MARK --set-mark 6
/sbin/iptables -t mangle -A PREROUTING -i eth2 -d 82.137.58.0/24 -j
MARK --set-mark 6
/sbin/iptables -t mangle -A PREROUTING -i eth2 -d 82.137.56.0/24 -j
MARK --set-mark 6
/sbin/iptables -t mangle -A PREROUTING -i eth2 -d 81.196.96.0/24 -j
MARK --set-mark 6
/sbin/iptables -t mangle -A PREROUTING -i eth2 -d 81.196.97.0/24 -j
MARK --set-mark 6
/sbin/iptables -t mangle -A PREROUTING -i eth2 -d 62.231.74.0/24 -j
MARK --set-mark 6
/sbin/iptables -t mangle -A PREROUTING -i eth2 -d 213.157.176.0/24 -j
MARK --set-mark 6
/sbin/iptables -t mangle -A PREROUTING -i eth2 -d 192.226.30.0/24 -j
MARK --set-mark 6
/sbin/iptables -t mangle -A PREROUTING -i eth2 -d 193.231.7.0/24 -j
MARK --set-mark 6
/sbin/iptables -t mangle -A PREROUTING -i eth2 -d 192.129.4.0/24 -j
MARK --set-mark 6
/sbin/iptables -t mangle -A PREROUTING -i eth2 -d 193.231.15.0/24 -j
MARK --set-mark 6
#end metro
#
#2. Anything else
/sbin/iptables -t mangle -A PREROUTING -i eth2 -d 0/0 -j MARK --set-mark 5
/sbin/tc qdisc del dev eth2 root
echo "Deleted old root disk on eth2"

/sbin/tc qdisc add dev eth2 root handle 1: htb default 10
/sbin/tc class add dev eth2 parent 1: classid 1:1 htb rate 10M
#metro
/sbin/tc class add dev eth2 parent 1:1 classid 1:10 htb rate 10M
/sbin/tc filter add dev eth2 protocol ip parent 1:10 prio 3 handle 6 flowid
1:10
#international
/sbin/tc class add dev eth2 parent 1:1 classid 1:2 htb rate 10M
/sbin/tc filter add dev eth2 protocol ip parent 1:10 prio 3 handle 5 flowid
1:2

/sbin/tc class add dev eth2 parent 1:1 classid 1:11 htb rate 50kbit ceil
100kbit prio 5
/sbin/tc filter add dev eth2 parent 1:0 protocol ip prio 5 u32 match ip dst
192.168.254.10 flowid 1:11

/sbin/tc class add dev eth2 parent 1:1 classid 1:12 htb rate 50kbit ceil
100kbit prio 5
/sbin/tc filter add dev eth2 parent 1:0 protocol ip prio 5 u32 match ip dst
192.168.254.11 flowid 1:12

/sbin/tc class add dev eth2 parent 1:1 classid 1:13 htb rate 50kbit ceil
100kbit prio 5
/sbin/tc filter add dev eth2 parent 1:0 protocol ip prio 5 u32 match ip dst
192.168.254.12 flowid 1:13

/sbin/tc class add dev eth2 parent 1:1 classid 1:14 htb rate 50kbit ceil
100kbit prio 5
/sbin/tc filter add dev eth2 parent 1:0 protocol ip prio 5 u32 match ip dst
192.168.254.13 flowid 1:14
.... etc


_______________________________________________
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