Friday, October 1, 2010

IPTRAF - Bandwidth Usage Monitor In Linux

If you are a Sysadmin in a company and have a Linux based network, how will you determine quickly what is getting downloaded on a particular user system? In my office we have a bandwidth monitor graph that shows the total download and upload usage of an INTERNET connection with BLUE(download) and GREEN(upload) lines in realtime(updates at every second). But this shows the total usage in the entire office. Sometimes I see that the download on a specific connection goes very high(as blue line goes high). That means that one or more system(s) is downloading a big file from the web. This is really annoying as it eats up the bandwidth resulting into slow connection.

What to do? How to detect it without physically visiting each and every desk?

Simple ....  IPTRAF is the solution.


Just install IPTRAF of your linux based Internet Sharing Server and you can get all the bandwidth usage related information of each and every system connected with that.

IPTRAF

Installation : Download the rpm package and install with yum on the ISS Server.

How to use

1. Log-in on the ISS Server through ssh.
2. Give the command iptraf at the prompt.
3. Iptraf interface will open. Press any key to continue.
4. Next you will see the Menu of Iptraf.
5. Press enter on IP Traffic Monitor.
6. Go through the applicable network interface i.e the interface you want to monitor (eth0, eth1, lo,). You can select All Interfaces in case you want to monitor the lan, wan and the local loop together.

Lets take the eth1 as an example. Suppose eth1 is the LAN connection in your office. Now when you will choose the eth1 interface to monitor, it will show the IP of the systems currently connected with the server. You can do a "sort by packet" / "sort by bytes" to sort out the local IP of the systems consuming the highest bandwidth in an decreasing order.

Each and every system IP will be connected with a Public IP. This public IP is the IP of the website they are connected with at present. Hence, in this way you can quickly determine the system that would be affecting the internet speed by downloading big files.