Security O & M: network real-time traffic monitoring tool iftop

Source: Internet
Author: User

Network management is a very important task in basic O & M. In the seemingly peaceful network operation, there is actually a surging dark stream, so we must ensure the stable operation of the business system, network O & M personnel must understand the network traffic status, usage of each network segment, bandwidth utilization, and network bottlenecks. When the network fails, it is necessary to promptly discover and quickly locate the problem to solve the problem. This requires the assistance of some network monitoring tools, this section describes iftop, a small but powerful real-time network traffic monitoring tool.

I. What can iftop do?

Iftop is a free real-time network card Traffic monitoring tool, similar to the top command in Linux. Iftop can monitor the real-time traffic, port connection information, reverse resolution IP address, and so on of the specified Nic. It can also precisely display the network traffic of the Local Machine and the traffic set of communication between each host and the local machine in the network, it is very suitable for monitoring the network traffic of proxy servers or routers. At the same time, iftop is very effective for hosts with abnormal traffic detection. The iftop output can quickly locate the root cause of abnormal host traffic, which is very useful for network troubleshooting and network security detection.


Ii. Installation of iftop

Iftop official site: http://www.ex-parrot.com/pdw/iftop/, the latest stable version of the current iftop-0.17. The installation of iftop is very simple, including source code compilation and installation and Yum installation. Here we take centos6.4 as an example.


(1) Compile and install iftop in source code

Install the required software library for iftop:

[[Email protected] ~] # Yum install libpcap-devel ncurses-devel

[[Email protected] ~] # Yum install flex byacc


Download iftop, compile and install it:

[[Email protected] ~] # Wget http://www.ex-parrot.com/pdw/iftop/download/iftop-0.17.tar.gz

[[Email protected] ~] # Tar zxvf iftop-0.17.tar.gz

[[Email protected] ~] # Cd iftop-0.17

[[Email protected] ~] #./Configure

[[Email protected] ~] # Make

[[Email protected] ~] # Make install


(2) Yum Installation

Install the required software library for iftop:

[[Email protected] ~] # Yum install libpcap-devel ncurses-devel

[[Email protected] ~] # Yum install flex byacc

[[Email protected] ~] # Wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

[[Email protected] ~] # Rpm-IVH epel-release-6-8.noarch.rpm

[[Email protected] ~] # Yum install iftop

In this way, iftop is installed.


Iii. Use iftop to monitor network interface card real-time traffic


After the iftop tool is installed, enter the iftop command to display the real-time traffic information of the NIC. By default, iftop displays the traffic information of the first network card of the system. to display the information of the specified network card, you can use the "-I" parameter.

(1) Description of iftop output interface

Run the "iftop-p-I Em1" command to obtain a typical iftop output interface, as shown in.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/4B/42/wKioL1Qo8OqhZ2f4AALLXOnnZCM394.jpg "Title =" 12.png" alt = "wkiol1qo8oqhz2f4aallxonnzcm394.jpg"/>

Iftop output can be divided into three parts:

The first part. Is the top line in the iftop output. This line is the traffic scale used to display the bandwidth traffic of the NIC.

The second part. Is the largest part of the iftop output. This part is divided into three columns: Left, center, and right. The left and middle columns record which IP addresses or hosts are connecting to the local network. The "=>" in the column indicates that the data is sent, and "<=" indicates that the data is received. You can clearly know the communication between two IP addresses by using this arrow. The rightmost column is divided into three small columns. These real-time parameters indicate the average traffic values of external IP addresses connected to the local machine within 2 seconds, 10 seconds, and 40 seconds. In addition, this section also has a traffic graph, which displays the traffic size dynamically based on the traffic scale in the first part. Through this traffic graph, you can easily see which IP Address has the largest traffic, and quickly locate possible traffic problems in the network.

The third part is located at the bottom of the iftop output and can be divided into three rows. "TX" indicates sending data, "RX" indicates receiving data, and "Total" indicates sending and receiving all traffic. There are three columns corresponding to these three rows. The "cum" column indicates the sending, receiving, and total data traffic from running iftop to the present. The "peak" column indicates the sending, receiving, and total traffic peaks. The "rates" column indicates the average traffic values of the past 2 s, 10 s, and 40 s.

(2) Description of iftop Parameters

Iftop also has many additional parameters and functions. Run "iftop-h" to display all the parameters that can be used by iftop. The following table lists the common parameters and meanings of iftop.

Parameter Description Example

-I: Specify the iftop-I Em1 Nic to be monitored

-N: displays the output host information through the IP address, without reverse DNS resolution of iftop-n

-B displays the network card Traffic in bytes units. The default value is bitsiftop-B.

-P runs iftop in hybrid mode. iftop can be used as a network sniffer to use iftop-P.

-N: only the connection port number is displayed, and the service name iftop-N corresponding to the port is not displayed.

-P: displays host and port information. This parameter is very useful for iftop-P.

-F: displays the inbound and outbound traffic of NICs for a specific network segment iftop-F 192.168.12.0/24

-M: set the maximum traffic scale on the top of the iftop output interface. The traffic scale is displayed in five segments: iftop-M.

(3) Interactive operations of iftop

In the real-time monitoring interface of iftop, you can also perform interactive operations on the output results to sort and filter the output information. On the displayed interface, press "H" to enter the interactive options interface, as shown in.

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/4B/42/wKioL1Qo8R3g0rIcAAJuO3uznh4579.jpg "Title =" 34.png" alt = "wkiol1qo8r1_0ricaajuo3uznh4579.jpg"/>

 


The interaction function of iftop is similar to the top command in Linux. The interaction parameters are divided into four parts: general parameters, host display parameters, port display parameters, and output sorting parameters. The meanings of related parameters are shown in the following table.


Parameter description

P this key enables you to pause/continue displaying

H. You can use this key to switch back and forth between the interaction parameter interface and the status output interface.

B can use this key to switch between display average traffic graphics

B can use this key to display the average traffic of 2 seconds, 10 seconds, and 40 seconds.

T this key can be used to switch whether to display the total traffic of each connection

J/K press J or K to scroll up or down the screen to display the current connection information

L use this key to enable the iftop output filtering function. For example, if you enter the IP address to be displayed, press enter to display only traffic information related to this IP address.

L you can use this key to switch the display traffic scale range. Different Scales will change the traffic graphics bar.

Q This key can be used to exit the iftop traffic monitoring page

N This key can be used to display iftop output results in IP or host name Mode

S. You can use this key to check whether the source host information is displayed.

D. You can use this key to check whether the remote target host information is displayed.

T you can use this key to switch the iftop display format. You can press this key to display it in sequence: send and receive traffic is displayed in two rows, send and receive traffic is displayed in one row, only send traffic is displayed, and only receive traffic is displayed.

N you can use this key to display the service name corresponding to the port number or port number.

S. You can use this key to check whether the local host port information is displayed.

D. You can use this key to check whether the port information of the remote target host is displayed.

P uses this key to switch whether to display port information

<Sort by local host name or IP address on the left

> This key can be used to sort by the host name or IP address of the remote target host.

O you can use this key to change whether the current connection is displayed.

Iftop is powerful in that it can display the network traffic status in real time and monitor the source IP address and target address of the network card Traffic, which is very useful for detecting server network faults and traffic exceptions, you can use only one command to quickly locate the causes of traffic exceptions or network faults. Therefore, iftop command is an indispensable network troubleshooting tool for O & M personnel.


This article from the "Technical Achievement dream" blog, please be sure to keep this source http://ixdba.blog.51cto.com/2895551/1559362

Security O & M: network real-time traffic monitoring tool iftop

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.