Slackware 10.2 Packet Shaper How-TO
Results 1 to 2 of 2

Thread: Slackware 10.2 Packet Shaper How-TO

  1. #1
    Senior Member
    Join Date
    Oct 2001

    Slackware 10.2 Packet Shaper How-TO

    For this tutorial I will be covering how to install "Mastershaper" on slackware 10.2
    Although I have tried to cover every aspect please do not forget to read the actual documentation.
    It has been written as a quick and dirty install guide. Many things could be improved. Such as start up scripts and Base install.

    This has been copied directly from my website so links do not work.
    Visit keo-geek for how-to with working links.

    I hope you enjoy.

    Installing MasterShaper on Slack 10.2

    This tutorial will explain how to install Mastershaper On a slackware 10.2 machine.
    For simplicity first install slackware 10.2 with Everything (FUll) install.
    Advanced users will need to make sure that Apache, PHP with JPEG, libgd support, and Mysql are installed

    Make sure to set Apache, ssh, and mysql to start up on boot.
    Once slack is finished installing login as root user.
    then type "su mysql" and press enter.

    This will log you in as the mysql user (this user is for mysqld only.

    Then type "mysql_install_db" this will install the "test" sql database.
    Now type "exit" and return to the root user.
    Now we need to install DB and Net_IPv4. This can be done by typeing "pear install DB Net_IPv4".
    If you get an error about DB already being installed its ok, just type "pear install Net_IPv4".
    Now it is time to change php so it can display the graphs once our install is finished.
    type "vi /etc/apache/php.ini" and edit "memory_limit 8M" to read "memory_limit 64M" (You may use 32 or 16 if you wish).
    now download the required packages from Mastershaper These will include mastershaper, phplayersmenu, and jpgraph.
    Also download phpmyadmin from here

    Installation of Mastershaper

    Ok that was just to get things setup. Now its time to put it all together. unzip mastershaper if master shaper ends with bz2 type "bunzip -d mastershaper-x.bz2" then "tar -xvvf mastershaper.tar" then type "mv Mastershaper-x.x.x shaper" This will rename mastershaper to shaper. Copy this folder to /var/www/htdocs/ "mv shaper /var/www/htdocs/" Next unpack phplayersmenu and jpgraph the same way. Rename the phplayersmenu-x.x.x folder to phplayersmenu and the jpgraph-x.x.x to jpgraph. Next move them to /var/www/htdocs/shaper/htdocs/ /var/www/htdocs/shaper /var/www/htdocs/shaper/htdocs/jpgraph /var/www/htdocs/shaper/htdocs/phplayersmenu Now its time to copy phpmyadmin to /var/www/htdocs/phpadmin tar -xvvf phpmyadmin-x.x.x.tar.gz > /var/www/htdocs/phpadmin Now fire up your web-browser and point it to the machine your working on (E.g. create a new database named shaper and a new user named shaper. Then close your browser and remove the phpadmin folder with either rm -r /var/www/htdocs/phpadmin or move it to a safe place like "mv /var/www/htdocs/phpadmin /tmp/" Now open and start your setup. You will get an error that config.dat can not be written to, open a shell and type "touch /var/www/htdocs/shaper/htdocs/config.dat" And then refresh the web-page. After the first part finishes you will need to either move or delete the setup directory. For safety reason I simply renamed it to setup-old "mv setup setup-old" It may also be needed to chmod 000 config.dat (More on security later)

    Setting up the bridge

    The bridge is pretty simple, it combines both eth0 and eth1 into one interface allowing traffic to pass right through.
    Copy this script into rc.bridge in the /etc/rc.d/ folder.
    NOTE: This script copied from net

    ---start script---

    slaveIfs="1 2 3 4 6 7 8 9 10";
    [ -z "$cmd" ] && cmd="start";
    case "$cmd" in
    brctl addbr br0;
    brctl stp br0 on;
    brctl addif br0 eth0;
    brctl addif br0 eth1;
    (ifdown eth0 1>/dev/null 2>&1;);
    (ifdown eth1 1>/dev/null 2>&1;);
    ifconfig eth0 up;
    ifconfig eth1 up;
    ifconfig br0 broadcast netmask up ### Adapt to your needs.
    route add default gw; ### Adapt to your needs.
    for file in br0 eth0 eth1;
    echo "1" > /proc/sys/net/ipv4/conf/${file}/proxy_arp;
    echo "1" > /proc/sys/net/ipv4/conf/${file}/forwarding;
    echo "1" > /proc/sys/net/ipv4/ip_forward;
    brctl delif br0 eth0;
    brctl delif br0 eth1;
    ifconfig br0 down;
    brctl delbr br0;
    #ifup eth0; ### Adapt to your needs.
    #ifup eth1; ### Adapt to your needs.
    $0 stop;
    sleep 3;
    $0 start;

    ---End Script---

    Then copy this script to /etc/rc.d/rc.shaper

    ---Start script---


    # Startup script for MasterShaper
    # Andreas Unterkircher,

    TC_COLLECTOR="./ -d"
    INIT_MS="php index.php"

    cd ${PATH_TO_MS}

    # See how we were called.
    case "$1" in
    echo -n "Starting MasterShaper: "
    ${INIT_MS} load
    echo -n "Shaper "
    echo ""
    echo -n "Stopping Mastershaper: "
    echo -n " "
    ${INIT_MS} unload
    echo "Shaper"
    $0 stop
    $0 start
    echo "Usage: $0 {start|stop|restart}"
    exit 1

    exit 0

    ---End Script---

    Now edit /etc/rc.d/rc.local and add these lines to it.

    /etc/rc.d/rc.bridge start
    /etc/rc.d/rc.shaper start

    For some reason makeing rc.bridge and rc.shaper executable does not start them on bootup, However remember to set
    rc.bridge and rc.shaper to 711 via "chmod 711 rc.shaper rc.bridge"

    You may need to change the ip addresses of some of the scripts make sure to check them over so they fit your needs.

    When everything looks good and your done, reboot the machine.
    make sure one of the nic ports is connected to a Net connection and a computer or hub/router/switch is plugged into the
    other nic port. With any luck you should be able to start adding rules. The graphs should also work.


    Since this device is now a bridge you can simply turn off ssh and apache after you have all the rules setup.
    I have heard that it is also possible to set the ip in rc.bridge to and the machine will still shape traffic
    This will remove all access to the machine, You could leave apache running and simply check the graphs from a local
    monitor/keyboard if needed.

    If you have any questions please feel free to ask.
    jeff at interl dot
    Whats a \"START\" button?

  2. #2
    Senior Member
    Join Date
    Nov 2005
    Hi spazzmatrix,

    Your tutorial is quite timely for me as I have been investigating MasterShaper's capabilities myself.

    I have some suggestions...

    Are there external links for mysql or Slackware?

    You have a number of typos, including 'makeing' and 'typeing'

    And IMHO formatting your tutorial for easy reading is essential if you want people to read it. You could number the steps and think about including <pre> tags around CLI steps, instead of having them in the middle of your paragraphs. It will make the page a lot longer, but improve readability immensly.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts