This guide is made by jessdk.
It will take around 2 hours to install the Debian Server with MasterShaper on.
My own complete "howto install MasterShaper" on a 100 % fresh installed "debian-40r1-i386-CD-1"
1. Under the installation of debian I just select a [X] standart
install ( No web server, no desktop and so on ONLY standart install )
2. Important Note: REMEMBER to setup a network mirror under your Debian installation ! ! ! !
Now you can log into your server via ssh.
Hey! KERNEL_DIR is not set.
Hey! IPTABLES_DIR is not set.
Loading patchlet definitions......................... done
Excellent! Source trees are ready for compilation.
Network packet filtering (replaces ipchains) ---> IP: Netfilter Configuration --->
<M> TIME match support
make-kpkg clean
make-kpkg --revision hbdebl7 --append-to-version .20071128 --initrd binary-arch
cd /usr/src/
ls
Now you can see this files... ( and some other files )
linux-image-2.6.18.20071128_hbdebl7_i386.deb
linux-headers-2.6.18.20071128_hbdebl7_i386.deb
dpkg -i linux-image-2.6.18.20071128_hbdebl7_i386.deb
nano /boot/grub/menu.lst
Set "Default 0" to the new kernel
( You do not need to change it Default 0 is the new kernel now )
Here we can see the old kernel
uname -a
Linux monitor 2.6.18-5-686 #1 SMP Fri Jun 1 00:47:00 UTC 2007 i686 GNU/Linux
reboot
Here we can see the new kernel
uname -a
Linux monitor 2.6.18.20071128 #1 SMP Sat Dec 15 21:43:09 CET 2007 i686 GNU/Linux
cd /usr/src/iptables-1.3.6
export KERNEL_DIR=/usr/src/linux-2.6.18
export IPTABLES_DIR=/usr/src/iptables-1.3.6 make
make BINDIR=/usr/local/sbin LIBDIR=/usr/local/lib MANDIR=/usr/local/man
make BINDIR=/usr/local/sbin LIBDIR=/usr/local/lib MANDIR=/usr/local/man install
cd /usr/src/l7-protocols-2007-10-10
make install
In this forum I have found "ipp2p-0.99.6-r2.tar.gz"
ShadowStar ipp2p - http://linux.chinaunix.net/bbs/thread-914377-1-1.html
Now I have uploadet this file to my own site - Just follow the rest of my guide........
cd /usr/src/
wget http://mastershaper.paerehaven.dk/ipp2p-0.99.6-r2.tar.gz
tar zxvf ipp2p-0.99.6-r2.tar.gz
cd /usr/src/ipp2p-0.99.6-r2
make
cp libipt_ipp2p.so /usr/local/lib/iptables/
cp ipt_ipp2p.ko /lib/modules/2.6.18.20071128/
depmod -a
modprobe ipt_ipp2p
Here I have found iptables-ipid-2.1.tar.tar-Just follow my guide
http://linux.chinaunix.net/bbs/thread-888274-1-2.html
http://linux.chinaunix.net/bbs/thread-909127-1-2.html
cd /usr/src/
wget http://mastershaper.paerehaven.dk/iptables-ipid-2.1.tar.tar
tar xvf iptables-ipid-2.1.tar.tar
cd iptables-ipid-2.1
make
cp libipt_IPID.so /usr/local/lib/iptables/
cp ipt_IPID.ko /lib/modules/2.6.18.20071128/
depmod -a
modprobe ipt_IPID
modinfo ipt_IPID
Her is what you get now:
monitor:/usr/src/iptables-ipid-2.1# modinfo ipt_IPID
filename: /lib/modules/2.6.18.20071128/ipt_IPID.ko
author: Ssffzz1 <ssffzz1@126.com>
description: IP tables IPID modification module
license: GPL
vermagic: 2.6.18.20071128 SMP mod_unload 686 REGPARM gcc-4.1
depends: x_tables
apt-get install mysql-server-4.1
mysql
create database shaper;
grant all privileges on shaper.* to 'shaper'@'localhost' identified by 'shaper' with grant option;
exit
cd /usr/src
wget http://mastershaper.paerehaven.dk/mastershaper_0.44.tar.tar
tar -xjvf mastershaper_0.44.tar.tar
cd MasterShaper-0.44
apt-get install apache2
mkdir /var/www/shaper
cp -R htdocs/* /var/www/shaper/
chown -R www-data.www-data /var/www/shaper
cd /usr/src
apt-get install iproute sudo php4-pear php-db php4-mysql libphp-jpgraph libphp-phplayersmenu
pear install DB Net_IPv4
cd /var/www/shaper
ln -s /usr/share/php/libphp-phplayersmenu phplayersmenu
ln -s /usr/share/jpgraph jpgraph
nano /etc/sudoers
Add this line in the bottom so MasterShaper can get root privileges
www-data ALL=NOPASSWD: /var/www/shaper/shaper_loader.sh
apt-get install libapache2-mod-php4
sudo a2enmod php4
apt-get install php4-mysql
Now we must downgrade to jpgraph-1.22 so we can use or monitor in the webinterface
cd /usr/src
wget http://mastershaper.paerehaven.dk/jpgraph-1.22.tar.tar
tar -zxvf jpgraph-1.22.tar.tar
cd /usr/src/jpgraph-1.22/src/
cp /usr/src/jpgraph-1.22/src/*.* /usr/share/jpgraph/
nano /var/www/shaper/shaper_stats.php
Now change from this to this:
/* include jpgraph library
require_once "jpgraph/src/jpgraph.php";
require_once "jpgraph/src/jpgraph_line.php";
require_once "jpgraph/src/jpgraph_pie.php";
require_once "jpgraph/src/jpgraph_pie3d.php";
require_once "jpgraph/src/jpgraph_bar.php";
*/
require_once "/usr/share/jpgraph/jpgraph.php";
require_once "/usr/share/jpgraph/jpgraph_line.php";
require_once "/usr/share/jpgraph/jpgraph_pie.php";
require_once "/usr/share/jpgraph/jpgraph_pie3d.php";
require_once "/usr/share/jpgraph/jpgraph_bar.php";
/etc/init.d/apache2 stop
/etc/init.d/apache2 start
Usage Notes
To get help on the IPP2P IPTables plugin:
iptables -m ipp2p --help
To run the GUI:
http://localhost/shaper
On the first configuration screen, iptables should be set to '/usr/local/sbin/iptables'.
Now run the setup in the webinterface
AND NEXT REMBER TO SETUP A NEW USER IN THE WEBINTERFACE
Select MENU -> "Settings" -> "Users" -> "Create a new User"
REMENBER TO SELCECT "STATUS" TO "Enabled" now "SAVE"
NOW SELECT THE MENU "Setup" AND NOW YOU MUST SETUP DOWNLOAD / UPLOAD SPEED AND SO ON.....
Menu -> "Other" -> "Update L7 Protocols" Press Submit on the next scree.
Select MENU -> "Rules" -> "Load"
Select MENU -> "Overview"
Shaper Status is now "active"
cd /var/www/shaper
./tc_collector.pl -d
./tc_collector.pl -v3
Test Link jpgraph-2.2 + GD Here (Change your local IP in this link)
http://10.1.45.248/shaper/shaper_stats.php?show=chains&graphmode=0&showif=eth0&scalemode=kbit&uniqid=1164810657
Goto your webinterface and load your rules:
Select MENU -> "Rules" -> "Load"
cd /var/www/shaper
./tc_collector.pl -d
Congratulation now you have installed a MasterShaper
Now you MasterShaper is up and running.
IMPORTENT NOTE:
EVERY TIME YOU REBOOT YOUR SERVER THEN YOU NEED TO DO THIS:
cd /var/www/shaper
./tc_collector.pl -d
Goto your webinterface and load your rules:
Select MENU -> "Rules" -> "Load"
Now you MasterShaper is up and running.
IF NOT RUNNING NOW THEN RELOAD YOUR RULES AGAIN AND / OR DO THIS AGAIN:
cd /var/www/shaper
./tc_collector.pl -d
Goto your webinterface and load your rules:
Select MENU -> "Rules" -> "Load"
cd /var/www/shaper
./tc_collector.pl -v3
Now you can see all the data on ethx and ethx
Bridge setup
As Bonus I have include a bride setup for your installation -- Bridge setup --
Follow my guide:
apt-get install bridge-utils
nano /etc/network/interfaces file
auto lo
iface lo inet loopback
# auto eth2
# iface eth2 inet dhcp
# auto eth3
# iface eth3 inet dhcp
auto bridge01
iface bridge01 inet dhcp
pre-up ifconfig eth0 down
pre-up ifconfig eth1 down
pre-up brctl addbr bridge01
pre-up brctl addif bridge01 eth0
pre-up brctl addif bridge01 eth1
pre-up ifconfig eth0 0.0.0.0
pre-up ifconfig eth1 0.0.0.0
post-down ifconfig eth0 down
post-down ifconfig eth1 down
post-down ifconfig bridge01 down
post-down brctl delif bridge01 eth0
post-down brctl delif bridge01 eth1
post-down brctl delbr bridge01
/etc/init.d/networking restart
ifconfig
Now you can see the new bride - DONE
More good information about MasterShaper and Bridge can be found here:
http://www.mastershaper.org/index.php/MasterShaper_on_a_Linux-Bridge
/etc/init.d/apache2 stop
/etc/init.d/apache2 start
cd /var/www/shaper
./tc_collector.pl -d
Goto your webinterface and load your rules:
Select MENU -> "Rules" -> "Load"
Now you MasterShaper is up and running.
cd /var/www/shaper
./tc_collector.pl -v3 ( Press Ctrl + Z for to exit this again )
IMPORTEN:
Every time you reboot you server - then you must du this step here:
cd /var/www/shaper
./tc_collector.pl -d
Goto your webinterface and load your rules:
Select MENU -> "Rules" -> "Load"
Now you MasterShaper is up and running.
cd /var/www/shaper
./tc_collector.pl -v3 ( Press Ctrl + C for to exit this again )
And now you can see the data on your interfaces.
Install Ntop Network Monitor 3.3
Install Ntop Network Monitor.
apt-get install rrdtool libpcap-dev graphviz librrd2-dev libtool
apt-get install automake autoconf libgdbm-dev snmp openssl libcurl3-openssl-dev libpcap0.8-dev
apt-get install gsfonts-x11
cd /usr/src/
wget http://mastershaper.paerehaven.dk/ntop-3.3.tar.tar
tar xzvf ntop-3.3.tar.tar
cd /usr/src/ntop-3.3
./autogen.sh
./configure
make
make install
NOTE: ntop can show traffic by AS (Autonomous System) Number
Because this feature consumes a number of MB of memory,
the datafile is not installed by default.
Which, if there is no file - from this or a previous
install - effectively disables the ASN feature.
To install the AS data, type:
- make install-data-as
ls: /usr/local/lib/*ntop*.so: No such file or directory
ls: /usr/local/lib/*Plugin*.so: No such file or directory
WARNING: This install created a directory for the ntop
files and databases:
//usr/local/share/ntop
This directory MUST be owned by the user
which you are going to use to run ntop.
The command you must issue is something like:
chown -R ntop.ntop //usr/local/share/ntop
or
chown -R ntop:users //usr/local/share/ntop
man chown to check the syntax for YOUR system
ntop -A
Now set your administrator password
groupadd ntop
useradd -s /bin/false -d /usr/local/var/ntop -g ntop ntop
chown -R ntop:ntop //usr/local/var/ntop
cd /usr/src/
wget http://mastershaper.paerehaven.dk/rrdtool-1.2.26.tar.tar
tar xvfz rrdtool-1.2.26.tar.tar
cd rrdtool-1.2.26
./configure
make
make install
ntop -P /usr/local/var/ntop -u ntop -d
Now go to your favorit web browser:
http://localhost:3000/
Or
http://Here you type your ip adress on your server:3000/
Username and Password in your web interface is now:
Username: admin
Password: The password you have give it
And after every reboot you need to type this command every time for to start Ntop Monitor.
ntop -P /usr/local/var/ntop -u ntop -d
Now you are running
You can stop Ntop 100% in your Ntop webinterface.
A good idea is to use Ntop for a shoot time to monitor the traffic on your network.
Another good idea is to delete this folders - interfaces - graphics - flows - when you are
finish your monitoring every day.
This folders will be restored next time you start up "Ntop" The folder - interfaces - is the
folder with the biggest files.
Here is how to delete the folders:
rm -r /usr/local/var/ntop/rrd/interfaces/
rm -r /usr/local/var/ntop/rrd/graphics/
rm -r /usr/local/var/ntop/rrd/flows/
Here is a little tip: NTOP -> RRD <- can fill out your 40
GB HDD harddisk drive with data on 2 days if there is many P2P users on
your network.
Then you can get in trouble with your system and your mysql server is not working anymore and so on.
I found a metod to free up my harddisk drive just delete this 3
folders " interfaces, graphics, flows " it take a lot of time to delete
35 GB data from a harddisk drive
rm -r /usr/local/var/ntop/rrd/interfaces/
rm -r /usr/local/var/ntop/rrd/graphics/
rm -r /usr/local/var/ntop/rrd/flows/
Now you will have a LOT of FREE SPACE again
MUNIN
As BONUS I also have made a howto install munin on this machine
Use this tip if you will see a lot of statistics on your server:
localhost.localdomain :: [ Disk Exim Mysql Network Processes System ] and so on it is a really nice tool.
apt-get install munin munin-node
/etc/init.d/munin-node restart
http://localhost/munin/
or
http://her is your IP on your server/munin/
Источник: http://www.mastershaper.org/index.php/Howto_install_MasterShaper%22_on_a_100%25_fresh_installed_%22_debian_-_40r1_-_i386