Re: [LARTC] How to do ensure bandwith

Linux Advanced Routing and Traffic Control

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

 



hi:
Stef and everybody
I use tc with htb more than one month.
This is my Network settings

Local Network 192.168.1.0/24 ---| eth0:192.168.1.1 Linux Box eth1:172.16.1.1 | -- Internet

In order to ensure bandwidth
on eth1 I have create a default 20

              20:1 (10Mbps)
 20:20 20:21 20:22 20:23 20:24
(20Mbps) (20Mbps) (20Mbps) (20Mbps) (20Mbps)

on eth0 I have create only a default 20
    30:1 (10Mbps)
 30:20
(10Mbps)

Each class is isolated so it never lends it unused bandwidth to other classes. 
And each class is never using unused bandwidth from other classes.

first,eth1 and eth0 with same bandwith,I use eth1 Interface ensure totoal bandwith with 10Mbps. then I part eth1 with fine
qdisc.
My script that:

tc qdisc add dev eth0 root handle 20: htb default 20
tc class add dev eth0 parent 20: classid 20:1 htb rate 10240kbps ceil 10240kbps
tc class add dev eth0 parent 20:1 classid 20:20 htb rate 10240kbps ceil 10240kbps
tc qdisc add dev eth0 parent 20:20 sfq

tc qdisc del dev eth1 root
tc qdisc add dev eth1 root handle 30: htb default 20
tc class add dev eth1 parent 30: classid 30:1 htb rate 10240kbps ceil 10240kbps
tc class add dev eth1 parent 30:1 classid 30:20 htb rate 2048kbps ceil 2048kbps
tc qdisc add dev eth1 parent 30:20 sfq
tc class add dev eth1 parent 30:1 classid 30:21 htb rate 2048kbps ceil 2048kbps
tc qdisc add dev eth1 parent 30:21 sfq
tc class add dev eth1 parent 30:1 classid 30:22 htb rate 2048kbps ceil 2048kbps
tc qdisc add dev eth1 parent 30:22 sfq
tc class add dev eth1 parent 30:1 classid 30:23 htb rate 2048kbps ceil 2048kbps
tc qdisc add dev eth1 parent 30:23 sfq
tc class add dev eth1 parent 30:1 classid 30:24 htb rate 2048kbps ceil 2048kbps
tc qdisc add dev eth1 parent 30:24 sfq
tc filter add dev eth1 parent 30: protocol ip  handle 1 fw classid  30:20
tc filter add dev eth1 parent 30: protocol ip  handle 2 fw classid  30:21
tc filter add dev eth1 parent 30: protocol ip  handle 3 fw classid  30:22
tc filter add dev eth1 parent 30: protocol ip  handle 4 fw classid  30:23
tc filter add dev eth1 parent 30: protocol ip  handle 5 fw classid  30:24 


iptables -t mangle -A FORWARD -p tcp -o eth1 -s 192.168.1.2/32 --dport 80 -d 202.197.240.6/32 -j MARK --set-mark 3
iptables -t mangle -A PREROUTING -p tcp -i eth1 -s 192.168.1.2/32 --dport 80 -d 202.197.240.6/32 -j MARK --set-mark 3
iptables -t mangle -A FORWARD -p tcp -o eth1 -s 192.168.1.2/32 --dport 80 -d 195.27.176.155/32 -j MARK --set-mark 4
iptables -t mangle -A PREROUTING -p tcp -i eth1 -s 192.168.1.2/32 --dport 80 -d 195.27.176.155/32 -j MARK --set-mark 4
iptables -t mangle -A FORWARD -p tcp -o eth1 -s 192.168.1.2/32 --dport 80 -d 218.104.154.19/32 -j MARK --set-mark 5
iptables -t mangle -A PREROUTING -p tcp -i eth1 -s 192.168.1.2/32 --dport 80 -d 218.104.154.19/32 -j MARK --set-mark 5


I think that all traffic must thro eth0,then it will thro eth1 of one qdisc.

If my script is right ,I hope it will help newbie of tc.
If it mistake ,please everyone tell me :)



Do You Yahoo!?
"雅虎通网络KTV, 随时随地免费卡拉OK~~"

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