BREAKING NEWS
Lazada Indonesia

Tips and Trick

Category 6

Category 7

March 15, 2010

Bandwith Limiter with HTB

Install HTB-Tools
=================

mughie @ root: / # aptitude install shaper
mughie @ root: / tmp # tar zxvf HTB-tools-0.3.0a-i486-1.tgz
mughie @ root: / # mv / tmp / etc / * / etc /
mughie @ root: / # mv / tmp / sbin / * / sbin /
mughie @ root: / # mv / tmp / usr / * / usr /
mughie @ root: / # cp / etc / rc.d / rc.htb.new / etc / init.d / rc.htb
mughie @ root: / # chmod 755 / etc / init.d / rc.htb

HTB-Tools Configuration
=====================
Assumptions:
Total bandwidth = 2048 kbps
Number of Client = 4 Client
eth0 = upstream
eth1 = downstream

mughie @ root: / # cp / etc/htb/eth0-qos.cfg.new / etc/htb/eth0-qos.cfg
mughie @ root: / # cp / etc/htb/eth1-qos.cfg.new / etc/htb/eth1-qos.cfg

mughie @ root: / # vim / etc/htb/eth0-qos.cfg

insert from eth0-qos.cfg

#####################
Qos.cfg-eth0 # #
#-------------------#
# Mujinct@gmail.com #
#####################

class class_1 (
bandwidth 2048;
limit 2048;
burst 2;
priority 1;


client PC_1 (
bandwidth 512;
limit 512;
burst 2;
priority 1;
src (
192.168.0.10/32;
);
);

client PC_2 (
bandwidth 512;
limit 512;
burst 2;
priority 1;
src (
192.168.0.20/32;
);
);

client PC_3 (
bandwidth 512;
limit 512;
burst 2;
priority 1;
src (
192.168.0.30/32;
);
);

client PC_4 (
bandwidth 512;
limit 512;
burst 2;
priority 1;
src (
192.168.0.40/32;
);
);
);


class default (bandwidth 8;);


mughie @ root: / # vim / etc/htb/eth1-qos.cfg

insert from eth1-qos.cfg

#######################
# Eth1-qos.cfg #
#---------------------#
# Mujinct@gmail.com #
#######################

class class_1 (
bandwidth 2048;
limit 2048;
burst 2;
priority 1;


client PC_1 (
bandwidth 512;
limit 512;
burst 2;
priority 1;
ff (
192.168.0.10/32;
);
);

client PC_2 (
bandwidth 512;
limit 512;
burst 2;
priority 1;
ff (
192.168.0.20/32;
);
);

client PC_3 (
bandwidth 512;
limit 512;
burst 2;
priority 1;
ff (
192.168.0.30/32;
);
);

client PC_4 (
bandwidth 512;
limit 512;
burst 2;
priority 1;
ff (
192.168.0.40/32;
);
);
);


class default (bandwidth 8;);

Configuration Check
===============

mughie @ root: / # q_checkcfg / etc/htb/eth0-qos.cfg
Default bandwidth: 8

Class class_1, CIR: 2048, MIR: 2048
** 4 clients, CIR2: 2048, MIR2: 2048

1 classes; CIR / MIR = 2048 / 2048; CIR2 / MIR2 = 2048 / 2048

mughie @ root: / # q_checkcfg / etc/htb/eth1-qos.cfg
Default bandwidth: 8

Class class_1, CIR: 2048, MIR: 2048
** 4 clients, CIR2: 2048, MIR2: 2048

1 classes; CIR / MIR = 2048 / 2048; CIR2 / MIR2 = 2048 / 2048


Activate Shaper
===============

mughie @ root: / # / etc / init.d / rc.htb start

Starting HTB-tools on eth0 ...
Checking the config files ... OK
Checking kernel support for HTB: present.
HTB-tools was successfuly started on eth0.


Starting HTB-tools on eth1 ...
Checking the config files ... OK
Checking kernel support for HTB: present.
HTB-tools was successfuly started on eth1.

See Traffic
===========

mughie @ root: / # / etc / init.d / rc.htb show_eth0
mughie @ root: / # / etc / init.d / rc.htb show_eth1

Post a Comment

 
Copyright © 2013 Just Scribble Hand
JSH