Sunday, April 23, 2006

Hierarchichal Token Bucket

Want to control your internet traffic? use HTB! Before start configuring, you must know your internet bandwidth, both uplink and downlink. In this example my uplink 64 Kbps and 384 Kbps for downlink. So, let's we start.

Step 1: Get it what you needGo to Sourceforge.net and download htbinit-xx.x.y, put it on /etc/init.d/. Usually I change its name become htbinit only.

Step 2: Becoming daemon
after you put in /etc/init.d then change permission to 755 and make it as a daemon.
# sudo update-rc.d htbinit defaults

Step 3: Shape your client's bandwidth
Create directory /etc/sysconfig/htb/ and write this into files:
===============
eth0
R2Q=1

eth0-10.root
RATE=64Kbit
BURST=15k

eth0-10:10.www
RATE=64Kbit
BURST=15k
LEAF=sfq
RULE=*:80,

eth0-10:20.smtp
RATE=56Kbit
CEIL=64Kbit
BURST=15k
LEAF=sfq
RULE=*:25,

eth0-10:30.others
RATE=4Kbit
CEIL=8Kbit
BURST=15k
LEAF=sfq
===============
eth1
R2Q=1

eth1-10.root
RATE=384Kbit
QUANTUM=15k

eth1-10:20.cpu01
RATE=32Kbit
QUANTUM=15k
CEIL=64Kbit
LEAF=sfq
RULE=192.168.0.1/32

eth1-10:30.cpu02
RATE=64Kbit
QUANTUM=15k
CEIL=128Kbit
LEAF=sfq
RULE=192.168.0.2/32
===============

Step 4: Finally, start your htbinit
# sudo /etc/init.d/htbinit compile
# sudo /etc/init.d/htbinit start

0 Comments:

Post a Comment

<< Home