Sebelum Qta mengerjakan sesuatu, Qta harus tau sesuatu itu dulu dan untuk apa sesuatu itu...Sekarang Qta ngomongin HTB, jadi setidak nya Qta harus mengerti tentang HTB dan untuk apa HTB itu.
Apa HTB itu...?
HTB Hierarchichal Token Bucket adalah suatu classful qdisc yang ditulis oleh martin Devera dengan suatu [yang] lebih sederhana satuan bentuk wujud parameter dibanding CBQ. Ada banyak dokumentasi pada [atas] lokasi pengarang dan juga pada [atas] Stef website Coene'S tentang HTB dan penggunaannya.
HTB.INIT adalah suatu shell script yg berasal dari CBQ.INIT yang mempermudah pengaturan traffic control HTB-BASED di Linux. HTB ( Hierachical Token Bucket) adalah suatu disiplin antrian baru yang (mana) mencoba untuk memperbaiki kelemahan dari implementasi CBQ.
Untuk Intalasi HTB, alangkah baiknya menyiapkan satu bungkus roko LA Mentol ama satu gelas kopi susu ABC dan makanan ringan,
Diatro yang di gunakan adalah Redhat Linux 72 dan 73
Tidak ada copyright apapun dalam dokumen ini, anda bebas menyalin, mencetak, maupun memodifikasi (Dengan menyertakan nama penulis asli).
Semoga bermanfaat dan memajukan opensource software di Indonesia.
Pastikan login ke server anda dalam root
1. Instalasi Kernel 2.4.22
Untuk instalasi kernel, anda bisa membaca artikel mas asfik dengan judul kompilasi kernel 2.4.x di linux
dan tambahankan
bagian QOS and/or fair queueing
CONFIG_NET_SCHED=y
CONFIG_NET_SCH_CBQ=m
CONFIG_NET_SCH_HTB=m
CONFIG_NET_SCH_CSZ=m
CONFIG_NET_SCH_ATM=m
CONFIG_NET_SCH_PRIO=m
CONFIG_NET_SCH_RED=m
CONFIG_NET_SCH_SFQ=m
CONFIG_NET_SCH_TEQL=m
CONFIG_NET_SCH_TBF=m
CONFIG_NET_SCH_GRED=m
CONFIG_NET_SCH_DSMARK=m
CONFIG_NET_SCH_INGRESS=m
CONFIG_NET_QOS=y
CONFIG_NET_ESTIMATOR=y
CONFIG_NET_CLS=y
CONFIG_NET_CLS_TCINDEX=m
CONFIG_NET_CLS_ROUTE4=m
CONFIG_NET_CLS_ROUTE=y
CONFIG_NET_CLS_FW=m
CONFIG_NET_CLS_U32=m
CONFIG_NET_CLS_RSVP=m
CONFIG_NET_CLS_RSVP6=m
CONFIG_NET_CLS_POLICE=y
1.1 Atau install kernel cara saya (semoga anda beruntung!!)
[root@probiotik hanny]#cd /usr/src
[root@probiotik src]#wget http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.22.tar.gz
[root@probiotik src]#tar -xzvf linux-2.4.22.tar.gz
[root@probiotik src]#ln -s linux-2.4.22 linux
[root@probiotik src]#cd linux
[root@probiotik linux]#make mrproper
Anda bisa copy salinan dari config kernel saya
[root@probiotik linux]#wget http://www.rsds.or.id/linux/configure/config-kernel.2.4.22.hanny
[root@probiotik linux]#mv config-kernel.2.4.22.hanny .config
Tambahkan atau Kurangi hadware pendukung yang anda punya, seperti :
Processor type and features --->
SCSI support --->
Network device support --->
Amateur Radio support --->
IrDA (infrared) support --->
Sound --->
USB support --->
Bluetooth support --->
[root@probiotik linux]#make menuconfig
[root@probiotik linux]#make modules; make modules_install
[root@probiotik linux]#make bzImage
[root@probiotik linux]#cp System.map /boot/System.map-2.4.22
[root@probiotik linux]#cp arch/i386/boot/bzImage /boot/vmlinuz-2.4.22
1.2 Tambahkan kernel baru anda pada lilo.conf
[root@probiotik linux]#vi /etc/lilo.conf
#--------Isi lilo.conf------------
prompt
boot=/dev/hda
timeout=50
message=/boot/message
install=/boot/boot.b
root=/dev/hda2
default=2.4.22
linear
#kernel lama
image=/boot/vmlinuz-2.4.7-10
label=2.4.7-10
root=/dev/hda2
read-only
initrd=/boot/initrd-2.4.7-10.img
#kernel baru
image=/boot/vmlinuz-2.4.22
label=2.4.22
root=/dev/hda2
read-only
#--------------------------------
1.3 Aktivkan kernel baru dan restart linux anda
[root@probiotik linux]#/sbin/lilo -v
[root@probiotik linux]#/sbin/lilo
[root@probiotik linux]#reboot
1.4 Cek kernel anda
[root@probiotik hanny]#uname -a
Linux probiotik 2.4.22 #2 Wed Nov 12 12:55:20 WIT 2003 i686 unknown
2. Upgrade Iptables
Untuk menghindari agar Iptables Linux anda masih tetap berjalan dan tidak ada troble karna karnel sebail nya Upgrade Iptables.
2.1 Instalasi iptables-1.2.9
[root@probiotik hanny]#wget http://www.netfilter.org/files/iptables-1.2.9.tar.bz2
[root@probiotik hanny]#tar -xjvf iptables-1.2.9.tar.bz2
[root@probiotik hanny]#cd iptables-1.2.9
[root@probiotik iptables-1.2.9]#make KERNEL_DIR=/usr/src/linux
[root@probiotik iptables-1.2.9]#make install KERNEL_DIR=/usr/src/linux
[root@probiotik iptables-1.2.9]#make install-devel
2.2 Backup iptables lama anda
[root@probiotik iptables-1.2.9]#mv /sbin/ip6tables /sbin/ip6tables.old
[root@probiotik iptables-1.2.9]#mv /sbin/iptables /sbin/iptables.old
[root@probiotik iptables-1.2.9]#mv /sbin/iptables-restore /sbin/iptables-restore.old
[root@probiotik iptables-1.2.9]#mv /sbin/iptables-save /sbin/iptables-save.old
2.2 Menggunakan iptables baru
[root@probiotik iptables-1.2.9]#ln -s /usr/local/sbin/ip6tables /sbin/
[root@probiotik iptables-1.2.9]#ln -s /usr/local/sbin/iptables /sbin/
[root@probiotik iptables-1.2.9]#ln -s /usr/local/sbin/iptables-restore /sbin/
[root@probiotik iptables-1.2.9]#ln -s /usr/local/sbin/iptables-save /sbin/
2.3 Coba jalankan iptables baru
[root@probiotik iptables-1.2.9]#iptables
iptables v1.2.9: no command specified
Try `iptables -h' or 'iptables --help' for more information.
3. INSTALASI HTB (Hierachical Token Bucket)
Ada banyak cara untuk membuat shapper htb, anda bisa membuat secara manual dengan command tc
atau anda bisa mengunakan htb.init. Kebetulan saya menggunakan htb.init :D
3.1 Persiapan untuk config htb.init
Download htb.init
[root@probiotik iptables-1.2.9]#wget wget http://heanet.dl.sourceforge.net/sourceforge/htbinit/htb.init-v0.8.5
[root@probiotik iptables-1.2.9]#cp htb.init-v0.8.5 /etc/init.d/htb.init
[root@probiotik iptables-1.2.9]#chmod 755 /etc/init.d/htb.init
3.2 Membuat config pada /etc/sysconfig
[root@probiotik iptables-1.2.9]#mkdir /etc/sysconfig/htb
[root@probiotik iptables-1.2.9]#touch /etc/sysconfig/htb/eth0
[root@probiotik iptables-1.2.9]#touch /etc/sysconfig/htb/eth0-10.root
[root@probiotik iptables-1.2.9]#touch /etc/sysconfig/htb/eth0-10:20.hanny
[root@probiotik iptables-1.2.9]#touch /etc/sysconfig/htb/eth0-10:30.dedy
[root@probiotik iptables-1.2.9]#touch /etc/sysconfig/htb/eth0-10:40.amek
[root@probiotik iptables-1.2.9]#touch /etc/sysconfig/htb/eth1
[root@probiotik iptables-1.2.9]#touch /etc/sysconfig/htb/eth1-10.root
[root@probiotik iptables-1.2.9]#touch /etc/sysconfig/htb/eth1-10:20.hanny
[root@probiotik iptables-1.2.9]#touch /etc/sysconfig/htb/eth1-10:30.dedy
[root@probiotik iptables-1.2.9]#touch /etc/sysconfig/htb/eth1-10:40.amek
====> #eth0-10:20.aa-ul
RATE=16Kbit
QUANTUM=1500
CEIL=64Kbit
LEAF=sfq
MARK=2
====> #eth0-10:20.aa- dwon
RATE=16Kbit
QUANTUM=1500
CEIL=64Kbit
LEAF=sfq
MARK=2
Isi dari masing-masing config htb adalah sebagai berikut:
eth0
eth0-10.root
eth0-10:20.hanny
eth0-10:30.dedy
eth0-10:40.amek
R2Q=1
RATE=64Kbit
QUANTUM=1500 RATE=32Kbit
QUANTUM=1500
CEIL=64Kbit
LEAF=sfq
RULE=192.168.1.2/32, RATE=16Kbit
QUANTUM=1500
CEIL=64Kbit
LEAF=sfq
RULE=192.168.1.3/32, RATE=16Kbit
QUANTUM=1500
CEIL=64Kbit
LEAF=sfq
RULE=192.168.1.4/32,
eth1
eth1-10.root
eth1-10:20.hanny
eth1-10:30.dedy
eth1-10:40.amek
R2Q=1
RATE=128Kbit
QUANTUM=1500 RATE=64Kbit
QUANTUM=1500
CEIL=128Kbit
LEAF=sfq
RULE=192.168.1.2/32 RATE=32Kbit
QUANTUM=1500
CEIL=128Kbit
LEAF=sfq
RULE=192.168.1.3/32 RATE=32Kbit
QUANTUM=1500
CEIL=128Kbit
LEAF=sfq
RULE=192.168.1.4/32
Bila masih bertanya tanya apa yang dimaksud dgn RATE,QUANTUM,CEIL,LEAF,RULE,dll
anda dapat membaca pada file htb.init
[root@probiotik iptables-1.2.9]#vi /sbin/htb.init-v0.8.4
3.3 Jalankan htb.init
Karena command tc (Trafic Control) terdapat kekurangan, maka anda dapat mengambil patch http://www.rsds.or.id/linux/source/tc
[root@probiotik iptables-1.2.9]#wget http://www.rsds.or.id/linux/source/tc
[root@probiotik iptables-1.2.9]#cp tc /sbin/
[root@probiotik iptables-1.2.9]#cp tc /bin/
[root@probiotik iptables-1.2.9]#/sbin/htb.init-v0.8.4
Usage: htb.init-v0.8.4 {start|compile|stop|restart|timecheck|list|stats}
[root@probiotik iptables-1.2.9]#/sbin/htb.init-v0.8.4 compile
[root@probiotik iptables-1.2.9]#/sbin/htb.init-v0.8.4 start
Lihat pesan pada log
[root@probiotik iptables-1.2.9]#tail -f /var/log/messages
Nov11 00:58:40 probiotik kernel: HTB init, kernel part version 3.12
3.4 Cek pada list module linux anda
[root@probiotik iptables-1.2.9]#lsmod
cls_route 4176 0 (unused)
cls_u32 4752 6
cls_fw 2496 0 (unused)
sch_sfq 3760 6 (unused)
sch_htb 18768 2
Bila anda sudah bosan dengan htb :)
[root@probiotik iptables-1.2.9]#/sbin/htb.init-v0.8.4 stop
3.5 Agar bisa autorun saat restart, tambahkan script pada rc.local
[root@probiotik iptables-1.2.9]#echo /sbin/htb.init-v0.8.4 start > /etc/rc.local
4. INSTALASI CBQ (Class-Based Queueing)
Ada banyak cara untuk membuat shapper CBQ, anda bisa membuat dengan cbq.init
4.1 Persiapan untuk config CBQ.init
Download CBQ.init
[root@probiotik iptables-1.2.9]#wget http://heanet.dl.sourceforge.net/sourceforge/cbqinit/cbq.init-v0.7.1
[root@probiotik iptables-1.2.9]#mv cbq.init-v0.7.1 /sbin/
[root@probiotik iptables-1.2.9]#chmod 755 cbq.init-v0.7.1
4.2 Membuat config pada /etc/sysconfig
Bila dalam kernel lama sudah terdapat direktori /etc/sysconfig/cbq , maka anda cukup membuat file-file cbq-xxx.xxx.
Jika terdapat file example-cbq dalam direktori /etc/sysconfig/cbq, hapus dan buat file-file cbq-xxx.xxx yang baru :)
[root@probiotik iptables-1.2.9]#rm -rf /etc/sysconfig/cbq/
[root@probiotik iptables-1.2.9]#mkdir /etc/sysconfig/cbq
[root@probiotik iptables-1.2.9]#touch /etc/sysconfig/cbq/cbq-1001.hanny.downlink
[root@probiotik iptables-1.2.9]#touch /etc/sysconfig/cbq/cbq-1002.dedy.downlink
[root@probiotik iptables-1.2.9]#touch /etc/sysconfig/cbq/cbq-1003.amek.downlink
[root@probiotik iptables-1.2.9]#touch /etc/sysconfig/cbq/cbq-2001.hanny.upstrime
[root@probiotik iptables-1.2.9]#touch /etc/sysconfig/cbq/cbq-2002.dedy.upstrime
[root@probiotik iptables-1.2.9]#touch /etc/sysconfig/cbq/cbq-2003.amek.upstrime
Isi dari masing-masing config CBQ adalah sebagai berikut:
cbq-1001.hanny.downlink
cbq-1002.dedy.downlink
cbq-1003.amek.downlink
DEVICE=eth1,10Mbit,1Mbit
RATE=64Kbit
WEIGHT=6.4Kbit
LEAF=sfq
RULE=192.168.1.2/32 DEVICE=eth1,10Mbit,1Mbit
RATE=32Kbit
WEIGHT=3.2Kbit
LEAF=sfq
RULE=192.168.1.3/32 DEVICE=eth1,10Mbit,1Mbit
RATE=32Kbit
WEIGHT=3.2Kbit
LEAF=sfq
RULE=192.168.1.4/32
cbq-2001.hanny.upstrime
cbq-2002.dedy.upstrime
cbq-2003.amek.upstrime
DEVICE=eth0,10Mbit,1Mbit
RATE=32Kbit
WEIGHT=3.2Kbit
LEAF=sfq
RULE=192.168.1.2/32, DEVICE=eth0,10Mbit,1Mbit
RATE=16Kbit
WEIGHT=1.6Kbit
LEAF=sfq
RULE=192.168.1.3/32, DEVICE=eth0,10Mbit,1Mbit
RATE=16Kbit
WEIGHT=1.6Kbit
LEAF=sfq
RULE=192.168.1.4/32,
Bila masih bertanya tanya apa yang dimaksud dgn DEVICE,RATE,WEIGHT,LEAF,RULE,dll
anda dapat membaca pada file CBQ.init
[root@probiotik iptables-1.2.9]#vi /sbin/cbq.init-v0.7.1
atau lihat http://www.docum.org/stef.coene/qos/faq/cache/3.html
4.3 Jalankan CBQ.init
[root@probiotik iptables-1.2.9]#/sbin/cbq.init-v0.7.1
Usage: cbq.init-v0.7.1 {start|compile|stop|restart|timecheck|list|stats}
[root@probiotik iptables-1.2.9]#/sbin/cbq.init-v0.7.1 compile
[root@probiotik iptables-1.2.9]#/sbin/cbq.init-v0.7.1 start
4.4 Cek pada list module linux anda
[root@probiotik iptables-1.2.9]#lsmod
cls_route 4336 0 (unused)
cls_u32 5072 2
cls_fw 2720 0 (unused)
sch_sfq 3856 6
sch_tbf 2672 1
sch_cbq 11728 2
Bila anda sudah bosan dengan CBQ :)
[root@probiotik iptables-1.2.9]#/sbin/cbq.init-v0.7.1 stop
4.5 Agar bisa autorun saat restart, tambahkan script pada rc.local
[root@probiotik iptables-1.2.9]#echo /sbin/cbq.init-v0.7.1 start > /etc/rc.local
5. Tools untuk melihat limit bandwith
- MRTG http://people.ee.ethz.ch/~oetiker/webtools/mrtg/
- Iptraf http://www.linuxhelp.net/guides/iptraf/
Hhhmmmm...ga kerasa kopi ama rokok nya abizz
oC deh...
No comments:
Post a Comment