Installation of NTop




Authors:Dillard Blom & Harro Bruins
Date:18 august 2002
Related Product(s):SME 5.1.2 & 5.5 (both tested)
Most Recent HowTo: Minddigger NTop HowTo (Always check this!!!)


Introduction

Where TOP shows you the cpu usage, NTop does the trick for the current network usage. It displays a list of hosts that are currently using the network and reports information concerning the (IP and non-IP) traffic generated by each of them. NTop can be started either in a terminal window (by using intop) or in web mode. In the latter case, a web browser is needed to use the program.

NTop can also be used in conjunction with MySQL to achieve a full registration of all traffic, which could be usefull as a base for your self-made applications. In those cases we could think about user-limits or warning-systems in case weird packets appear in the network.


The Installation

  1. Install the libpcap-0.6.2-12.rpm:
    #> rpm -ivh ftp://ftp.redhat.com/pub/redhat/linux/7.3/en/os/i386/RedHat/RPMS/libpcap-0.6.2-12.i386.rpm


  2. Only for SME v5.1.2 you need to install openssl-0.9.6b-18.i386.rpm
    #> rpm -ivh --force ftp://ftp.redhat.com/pub/redhat/linux/7.3/en/os/i386/RedHat/RPMS/openssl-0.9.6b-18.i386.rpm
    (don't use -Uvh; that will kill about 50% of SME's functions)


  3. Install ntop-2.1.2:
    #> rpm -ivh http://unc.dl.sourceforge.net/sourceforge/ntop/ntop-2.1.2-0.i386.rpm


  4. Type at the command-line :
    #> chown -R nobody. /usr/share/ntop


  5. Type :
    #> /usr/sbin/ntop -P /usr/share/ntop -u nobody -A
    (and enter a selfchosen password, a verification is asked aswell)


  6. Edit the file /etc/rc.d/init.d/ntop (under the head start, around line 25, it states default "-u ntop" , replace this with "-u nobody").
    You could also add -w portnumber if you want the webinterface on a different port as 3000.


  7. Start with
    #> /etc/rc.d/init.d/ntop start
    or
    #> service ntop start


  8. Start NTop automatically during boot:
    #> ln -s /etc/rc.d/init.d/ntop /etc/rc7.d/S88ntop

How it works

Once installed and started you can use a web-browser and enter your server with the portnumber (standaard 3000) attached to it like:
http://192.168.1.1:3000 or http://www.mybestdomain.com:3000. A screen will open that needs time to make clear what kind of information is logged.
This screen also can be seen from the internet so it wouldn't be the best thing to leave the portnumber at 3000 but choose a less easy to guess number. The reason is offcourse a little higher security.


Expand to MySQL (optional and buggy)

Before you want to start on this section, be smart and read the information found on this link. http://lists.ntop.org/pipermail/ntop/2002-April/001658.html
Here you can read pretty well that there is a problem with the option -b and that it causes segmentation errors in NTop. After intensive searching for solutions we only can conclude there are none yet. NTop works but for some reason, that can't be pinpointed, it simply crashes and the perl script is filling up your buffer, alone. Which isn't a good thing for the cpu-usage offcourse.
  1. Download the following 2 files mySQLdefs.txt and mySQLserver.pl and place them in the map /usr/share/ntop
    Best thing to do is wget http://members.home.nl/timothee/ntop/mySQLserver.pl to prevent trouble with windows.


  2. Create the database NTOP in MySQL:
    #> mysqladmin create NTOP


  3. Import the structure for NTOP in MySQL:
    #> mysql NTOP < /usr/share/ntop/mySQLdefs.txt


  4. Make a special 'user' in MySQL to place/correct/erase the data:
    #> mysql
    mysql> grant all on NTOP.* to NTOP@localhost identified by 'NTOP';
    mysql> exit


  5. Only for SME 5.1.2
    Install perl-DBI by :
    #> rpm -ivh ftp://ftp.nluug.nl/pub/os/Linux/distr/RedHat/ftp/redhat/linux/7.2/en/os/i386/RedHat/RPMS/perl-DBI-1.18-1.i386.rpm
    Install perl-DBD-MySQL by :
    #> rpm -ivh ftp://ftp.nluug.nl/pub/os/Linux/distr/RedHat/ftp/redhat/linux/7.2/en/os/i386/RedHat/RPMS/perl-DBD-MySQL-1.2216-4.i386.rpm


  6. Starting the perl script to import the data:
    #> perl /usr/share/ntop/mySQLserver.pl > /dev/null &


  7. Adjust the NTop start script in /etc/rc.d/init.d/ntop around line 25:
    Place the parameter "-b localhost:4000" at the end of the startcommand line. Port 4000 is also used in the perl-script, only replace it when you know exactly what you are doing.
    Now NTop has to prove itself so lets do the procedure found in the previous section at item 7.

Tips





Disclaimer

Use this howto at your own risk! Although we tested everything several times without the occurance of any strange errors, we cannot 100% garantee it won't harm your server. The authors of this howto and the host Minddigger.com can't be held responsible for any damage caused by the usage of this howto.
If you have any comments, feel free to mail to howto@minddigger.com


© 2002 by Minddigger.com, Ervedo IT & Vexation InterNetServices