Shared.

Primary Menu

Linux Bandwidth Manager using Banjar (part 1)

Banjar stands for bandwidth justification for administrator, an open source software that provides simple bandwidth management tools for internet cafe or small to medium network administrators.

Banjar will manage your uplink and downlink bandwidth, let you define your networks and packages and then limit bandwidth for each of those packages on each networks. For Indonesian, you will find this tool useful as it separates IIX bandwidth and International bandwidth. Easy application to install and operate.

LICENSE

LGPL as in GNU Lesser General Public License. In short, you can include Banjar as a library into your own application, re-publish it, modify it, change it, use it, sell it, for free or paid. You don’t need to provide the source code when using Banjar with your own software or any other software. Only when you modify Banjar source codes, you will have to provide those modifications accessible for public.

CONTRIBUTORS

Main developer is Anton Raharja (me me mee..). Once I got helps from Abdul Hanan and Moses Kurniawan, mostly for web UI stuffs. Every now and then WAN-DKI team (Asoka, Engkos, Dedi, Husen, Sindu, Imam) helps in a way that they can do best, bug me to code fixes, updates and more features !

REQUIREMENTS

Below are software required to install Banjar. Most of them are already available on main stream Linux distros.

Linux (any linux capable of running iptables and tc with HTB)

Apache (any version, not tested on other web server)

MySQL or Sqlite3 (the default is Sqlite3)

PHP4 or PHP5 (wrote on php4 but will work on php5)

PHP PEAR and PEAR-DB

iptables (load connmark modules, automatic on most distros)

tc (iproute2 package)

cron (scheduler for writing rules to a shell script and execute them automatically)

svn (subversion package, this is optional, only for brave linux admin)

You may continue to installation part after all requirements above met.

INSTALLATION

Download the latest package from SourceForge, current release is Banjar version 0.8.1, and then extract it. But if you want the latest development you can get the code from Peanut Inc. SVN repository.

There are 2 (two) available alternatives to install, each of them having no more than 11 (eleven) steps to follow, most of them are usual steps to install PHP based applications.

The first is to use Sqlite3 as a back-end database and the second would be to use MySQL. Chose one of two.

Alternative 1 is suitable for production bandwidth manager routers where you don’t want to burden your machine with a full featured database engine like MySQL. Using Sqlite3 will reduce the need to use high-end PC for Linux routers as it just a text-file database, no sockets opened, no daemon running. But then I never conducted any benchmark, so don’t take my word for granted, please do your own tests.

Note:
All those chmod 666 or 777 below is considered not safe, for those who understands, please use chown to web server’s user and group instead.

ALTERNATIVE 1: USING SQLITE3 AS BACK-END DATABASE

Install Sqlite3 (tested on 3.4.2) on Ubuntu (tested on 7.10).

Steps:
# apt-get install sqlite3 php-pear php-db php5-sqlite3

Copy files and directories here to a directory under Web Server’s document root.Note:

For debian or ubuntu the default document root is /var/www

For redhat based distro the default document root is /var/www/html

For suse the default document root is /srv/www/htdocs

In this manual we are using ubuntu server, the document root is /var/www

Change banjar.sh permission to 777.Note:
You may want to take a look at config.php, see $apps_path[‘netfilter_exec’] and remember which filename used as netfilter execution file and its path, the default is banjar.sh

Steps:
# chmod 777 /usr/local/sbin/banjar.sh

Configure crontab file.Note:
As root type: crontab -e, this will open a crontab editor

Steps:
# crontab -e

Insert on crontab editor: * * * * * /usr/local/sbin/banjar.sh >/dev/null 2>&1Note:
This entry will automate the execution of /usr/local/sbin/banjar.sh every 1 (one) minute. This step is very important, without this Banjar will never automatically execute any changes.

Browse Banjar web panel and login (admin login is on config_password.php), the default would be:

username = admin

password = secret

ALTERNATIVE 2: USING MYSQL AS BACK-END DATABASE

Note:
If you already choose to use ALTERNATIVE 1, you don’t have to follow below steps.

Copy files and directories here to a directory under Web Server’s document root.Note:

For debian or ubuntu the default document root is /var/www

For redhat based distro the default document root is /var/www/html

For suse the default document root is /srv/www/htdocs

In this manual we are using ubuntu server, the document root is /var/www

Change banjar.sh permission to 777.Note:
You may want to take a look at config.php, see $apps_path[‘netfilter_exec’] and remember which filename used as netfilter execution file and its path, the default is banjar.sh

Steps:
# chmod 777 /usr/local/sbin/banjar.sh

Configure crontab file.Note:
As root type: crontab -e, this will open a crontab editor

Steps:
# crontab -e

Insert on crontab editor: * * * * * /usr/local/sbin/banjar.sh >/dev/null 2>&1Note:
This entry will automate the execution of /usr/local/sbin/banjar.sh every 1 (one) minute. This step is very important, without this Banjar will never automatically execute any changes.

Browse Banjar web panel and login (admin login is on config_password.php), the default would be:

username = admin

password = secret

That’s all folks. Installing is harder than using it, don’t wait up until my next article coz there may be a chance I won’t even write it :)

hi banjar users, i’m trying to setup banjar for my network, i have followed everything in the instruction but when i browse banjar directory it don’t display anything. i’m also wondering why the file “banjar.db” is empty. is it supposed to be so?
another thing is the path of the database name in the banjar.php ($db_param[‘name’] = “/etc/banjar/banjar.db”; ) is this path correct? i’m using MySQL database.
any help will be appreciated

# use SNAT
# this is just an example, network address value and SNAT target must be changed according to your network setup
# if you dont use this rule, or you dont provide NAT then you must mark below line as commented
# $IPTABLES -t nat -A POSTROUTING -s 192.168.1.0/24 -j SNAT –to-source 123.123.123.123

dear sir
Irealy serious get full information about voip rakyat that w’d aplicated on between my company to the other brands company.
c’d you inform simplefy what I shoud do including
soft and hardware for start.