We can use iftop to view real-time network traffic, monitor TCP/IP connections and other information. Its official website: http://www.ex-parrot.com/~pdw/iftop/
Some commonly used parameter commands:
View the real-time traffic of the ppp0 network interface:
# iftop -i ppp0
Display traffic in bytes (default is bits):
# iftop -B
Display IP directly without DNS reverse solution:
# iftop -n
Display the connection port number directly without displaying the service name:
# iftop -N
Display the incoming and outgoing packet traffic of the 192.168.1.0 network segment
# iftop -F 192.168.1.0/24 (or 192.168.1.0/255.255.255.0)
Other parameters can be seen under iftop -h.
Like top, when entering the iftop screen,
- You can press p to switch whether to display the connection port,
- n switch to display the domain name of IP or host,
- N switch to display the connection port code or name,
- p pauses the display,
- bSwitch whether to display the bar,
- B switches to calculate the average flow within a few seconds,
- Other keys can be viewed by pressing h. You can also set different variables according to ~/.iftoprc for direct reference in the future.
Iftop interface related instructions
What is displayed on the interface is a scale range similar to a scale, which is used as a ruler to display the long bar of the flow graph.
The two left and right arrows "<=" and "=>" in the middle represent the direction of traffic.
TX: sending traffic
RX: receiving traffic
TOTAL: total traffic
Cumm: total traffic from running iftop to the current time
peak: peak traffic
rates: represent the average traffic in the past 2s, 10s and 40s respectively
some frequently asked questions
1、make: yacc: Command not found
make: *** [grammar.c] Error 127
解决方法:apt-get install byacc / yum install byacc
2、configure: error: Curses! Foiled again!
(Can’t find a curses library supporting mvchgat.)
Consider installing ncurses.
解决方法:apt-get install libncurses5-dev / yum install ncurses-devel
References:
Use iftop to check your network card traffic under Linux
http://xok.la/2008/08/linux_interface_iftop.html
Use iftop to view real-time network traffic
http://www.linuxfly.org/post/247/
Linux traffic monitoring tool – iftop
http://www.iwanna.cn/archives/2010/07/30/4802/