Anda di halaman 1dari 7

Pastikan login pada server anda adalah sebagai 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
karena kernel, sebaiknya anda 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.

Dalam percobaan yang saya lakukan, ada 3 buah komputer.


Total Bandwith Internet downlink 128 Kbps dan upstrime = 64 Kbps.
komputer 1 bernama hanny dengan ip 192.168.1.2, akan di beri jatah downlink 64 Kbps,
upstrime 32Kbps.
komputer 2 bernama dedy dengan ip 192.168.1.3, akan di beri jatah downlink 32Kbps,
upstrime 16Kbps.
komputer 3 bernama amek dengan ip 192.168.1.4, akan di beri jatah downlink 32Kbps,
upstrime 16Kbps.

Untuk HTB, bila komputer hanny tidak menggunakan internet, maka bandwith akan pakai
FULLoleh komputer dedy dan komputer amek (bandwith downlink hanny 64Kbps bisa
dibuat rebutan FULL oleh dedy dan amek) sedangkan (bandwith upstrime hanny 32Kbps
dibuat rebutan FULL oleh dedy dan amek )

Untuk CBQ, bila komputer hanny tidak menggunakan internet, maka bandwith tidak bisa
pakai FULL oleh host dedy dan host amek (bandwith downlink hanny 64Kbps bisa dibuat
rebutan MAX 1 Kbps - 2 Kbps oleh dedy dan amek) sedangkan (bandwith upstrime hanny
32Kbps dibuat rebutan MAX 1 Kbps - 2 Kbps oleh dedy dan amek )

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 :)

3.1 Persiapan untuk config htb.init


Download htb.init
[root@probiotik iptables-1.2.9]#wget
http://keihanna.dl.sourceforge.net/sourceforge/htbinit/htb.init-v0.8.4
[root@probiotik iptables-1.2.9]#mv htb.init-v0.8.4 /sbin/
[root@probiotik iptables-1.2.9]#chmod 755 htb.init-v0.8.4

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

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 RATE=32Kbit RATE=16Kbit RATE=16Kbit
QUANTUM=1500 QUANTUM=1500 QUANTUM=1500 QUANTUM=1500
CEIL=64Kbit CEIL=64Kbit CEIL=64Kbit
LEAF=sfq LEAF=sfq LEAF=sfq
RULE=192.168.1.2/32, RULE=192.168.1.3/32, 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 RATE=64Kbit RATE=32Kbit RATE=32Kbit
QUANTUM=1500 QUANTUM=1500 QUANTUM=1500 QUANTUM=1500
CEIL=128Kbit CEIL=128Kbit CEIL=128Kbit
LEAF=sfq LEAF=sfq LEAF=sfq
RULE=192.168.1.2/32 RULE=192.168.1.3/32 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
atau lihat http://www.docum.org/stef.coene/qos/faq/cache/29.html

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 DEVICE=eth1,10Mbit,1Mbit DEVICE=eth1,10Mbit,1Mbit
RATE=64Kbit RATE=32Kbit RATE=32Kbit
WEIGHT=6.4Kbit WEIGHT=3.2Kbit WEIGHT=3.2Kbit
LEAF=sfq LEAF=sfq LEAF=sfq
RULE=192.168.1.2/32 RULE=192.168.1.3/32 RULE=192.168.1.4/32

cbq-2001.hanny.upstrime cbq-2002.dedy.upstrime cbq-2003.amek.upstrime


DEVICE=eth0,10Mbit,1Mbit DEVICE=eth0,10Mbit,1Mbit DEVICE=eth0,10Mbit,1Mbit
RATE=32Kbit RATE=16Kbit RATE=16Kbit
WEIGHT=3.2Kbit WEIGHT=1.6Kbit WEIGHT=1.6Kbit
LEAF=sfq LEAF=sfq LEAF=sfq
RULE=192.168.1.2/32, RULE=192.168.1.3/32, 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/

Thank's to
-------------------------------------------
http://luxik.cdi.cz/~devik/qos/htb/
http://www.docum.org/stef.coene/qos/faq/cache/

Hanny Wijaya (hanny@rsds.or.id) , irc.efnet.net #indolinux

Anda mungkin juga menyukai