See who's doing what on your network over time with ntop.
If you're looking for real-time network statistics, check out the terrific ntop tool (http://www.ntop.org). It is a full-featured protocol analyzer with a web frontend, complete with SSL and graphing support. Unfortunately, ntop isn't exactly lightweight (the precise amount of resources required depend on the size of your network and the volume of network traffic), but it can give you a very nice picture of who's talking to whom on your network.
ntop needs to run initially as root (to throw your interfaces into promiscuous mode and start capturing packets), but then releases its privileges to a user that you specify. If you decide to run ntop for long periods of time, you'll probably be happiest running it on a dedicated monitoring box (with few other services running on it, for security and performance reasons).
Here's a quick reference on how to get ntop up and running. First, create an ntop user and group:
# groupadd ntop # useradd -c "ntop user" -d /usr/local/etc/ntop \ -s /bin/true -g ntop ntop
Then unpack and build ntop per the instructions in docs/BUILD-NTOP.txt. I assume that you have the source tree unpacked in /usr/local/src/ntop-2.1.3/.
Create a directory for ntop to keep its capture database in:
# mkdir /usr/local/etc/ntop
Note that it should be owned by root, and not by the ntop user.
If you'd like to use SSL for HTTPS (instead of standard HTTP), then copy the default SSL key to /usr/local/etc/ntop. Assuming that you have unpacked ntop into /usr/local/src/ntop-2.1.3/, you can do this by running this command:
# cp /usr/local/src/ntop-2.1.3/ntop/*pem /usr/local/etc/ntop
Note that the default SSL key will not be built with the correct hostname for your server. So, you'll probably want to generate your own SSL certificate and key pair [Hack #45] . Now you'll need to initialize the ntop databases and set an administrative password:
# ntop -A -u ntop -P /usr/local/etc/ntop 21/Sep/2002 20:30:23 Initializing GDBM... 21/Sep/2002 20:30:23 Started thread (1026) for network packet analyser. 21/Sep/2002 20:30:23 Started thread (2051) for idle hosts detection. 21/Sep/2002 20:30:23 Started thread (3076) for DNS address resolution. 21/Sep/2002 20:30:23 Started thread (4101) for address purge. Please enter the password for the admin user: Please enter the password again: 21/Sep/2002 20:30:29 Admin user password has been set.
Finally, run ntop as a daemon, and start the SSL server on your favorite port (4242, for example):
# ntop -u ntop -P /usr/local/etc/ntop -W4242 -d
By default, ntop also runs a standard HTTP server on port 3000. You should seriously consider locking down access to these ports, either at your firewall or by using command-line iptables rules [Hack #33] .
Let ntop run for a while, then connect to https://your.server.here:4242/. You can find out all sorts of details about what traffic has been seen on your network, as shown in Figure 5-3.
While tools like tcpdump and Ethereal give you detailed, interactive analysis of network traffic, ntop delivers a wealth of statistical information in a very slick and easy-to-use web interface. When properly installed and locked down, it will likely become a favorite tool in your network analysis tool chest
?Rob Flickenger (Linux Server Hacks)