In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to check the network card traffic of Linux. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
I. iptraf
Installation method:
# yum install iptraf-y
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
Epel/metalink | 7.8 kB 00:00
* base: mirrors.163.com
* epel: mirrors.yun-idc.com
* extras: mirrors.aliyun.com
* updates: centos.ustc.edu.cn
Base | 3.7 kB 00:00
Epel | 4.7 kB 00:00
Epel/primary_db | 6.0 MB 00:00
Extras | 3.4 kB 00:00
Updates | 3.4 kB 00:00
Resolving Dependencies
-> Running transaction check
-> Package iptraf.x86_64 0RU 3.0.1-14.el6 will be installed
-> Finished Dependency Resolution
Dependencies Resolved
=
Package Arch Version Repository Size
=
Installing:
Iptraf x8631 64 3.0.1-14.el6 base 316k
Transaction Summary
=
Install 1 Package (s)
Total download size: 316 k
Installed size: 681 k
Downloading Packages:
Iptraf-3.0.1-14.el6.x86_64.rpm | 316 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: iptraf-3.0.1-14.el6.x86_64 1 Compact 1
Verifying: iptraf-3.0.1-14.el6.x86_64 1 Compact 1
Installed:
Iptraf.x86_64 0RO 3.0.1-14.el6
Complete!
Usage:
# iptraf
Press any key to continue to enter the following figure:
Parameter explanation:
Ip traffic monitoring
Simple interface statistics to view network traffic based on connection
Detailed interface statistics to view the traffic on each Nic, including internal and external networks
Statistical analysis
Lan statistics, according to mac address statistics
For specific usage, please refer to:
Https://www.landui.com/help/show-5067.html
II. Nload
Installation method:
# yum install-y nload
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* epel: mirror01.idc.hinet.net
* extras: mirrors.aliyun.com
* updates: centos.ustc.edu.cn
Resolving Dependencies
-> Running transaction check
-> Package nload.x86_64 0RU 0.7.4-1.el6 will be installed
-> Finished Dependency Resolution
Dependencies Resolved
=
Package Arch Version Repository Size
=
Installing:
Nload x8631 64 0.7.4-1.el6 epel 63k
Transaction Summary
=
Install 1 Package (s)
Total download size: 63 k
Installed size: 155 k
Downloading Packages:
Nload-0.7.4-1.el6.x86_64.rpm | 63 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: nload-0.7.4-1.el6.x86_64 1 Compact 1
Verifying: nload-0.7.4-1.el6.x86_64 1 Compact 1
Installed:
Nload.x86_64 0RO 0.7.4-1.el6
Complete!
# nload
Three: iftop
Installation method:
# yum install gcc flex byacc libpcap libpcap-devel ncurses ncurses-devel-y
# wget http://www.ex-parrot.com/pdw/iftop/download/iftop-0.17.tar.gz
# tar zxvf iftop-0.17.tar.gz
# cd iftop-0.17
#. / configure & & make & & make install
# iftop
Related parameters and instructions
1. Iftop interface instructions
The interface shows a scale range similar to that of a scale, which is used as a ruler for long bars that display flow patterns. The two left and right arrows in the middle indicate the direction of the traffic.
TX: sending traffic
RX: receive traffic
TOTAL: total traffic
Cumm: total traffic from running iftop to the current time
Peak: peak traffic
Rates: indicates the average traffic in the past 2s, 10s, 40s respectively
2. Iftop related parameters
Commonly used parameters
-I set the network card for monitoring, such as # iftop-I eth2
-B displays traffic in bytes (default is bits), such as # iftop-B
-n causes host information to display IP directly by default, such as # iftop-n
-N causes port information to display port number directly by default, such as # iftop-N
-F shows the inbound and outbound traffic of a specific network segment, such as # iftop-F 10.10.1.0 Universe 24 or # iftop-F 10.10.1.0 Universe 255.255.255.0
-h (display this message), help, display parameter information
-p after using this parameter, the list in the middle shows the local host information and IP information other than the local host appears.
-b to make the traffic graph bar display by default
-f this is not very good at using for the time being, it is used to filter and calculate packets.
-P makes host information and port information display by default
-m sets the maximum value of the scale at the top of the interface, which is displayed in five segments, for example: # iftop-m 100m
Some operation commands after entering the iftop screen (pay attention to case)
Press h to toggle whether to display help
Press n to toggle to display the IP or hostname of this machine
Press s to switch whether to display the host information of this computer.
Press d to toggle whether to display the host information of the remote target host
Toggle the display format by t to 2 lines / 1 lines / only send traffic / only received traffic
Press N to toggle to display the port number or port service name
Press S to toggle whether to display the port information of this machine.
Press D to toggle whether to display the port information of the remote target host
Press p to toggle whether to display port information
Press P to toggle pause / resume display
Press b to toggle whether to display the average flow graph bar
Calculate the average traffic within 2 seconds or 10 seconds or 40 seconds by B switch
Press T to toggle whether to display the total traffic for each connection
Press l to open the screen filtering function, and enter the characters to be filtered, such as ip. After pressing enter, the screen will only display the traffic information related to this IP.
Press L to switch the scale on the display screen; if the scale is different, the flow graph bar will change
Press j or k to scroll up or down the connection record displayed on the screen
Press 1 or 2 or 3 to sort according to the three columns of traffic data displayed on the right
Sort by the hostname or IP of the remote destination host
Press o to toggle whether to display only the current connection
Press f to edit the filter code
Press! You can use the Shell command
Press Q to exit the monitoring.
IV. Sar command
# sar-n DEV 1 4
Linux 2.6.32-696.el6.x86_64 (test2) 05kg 14 CPU 2019 _ x86mm 644)
03:30:35 PM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s
03:30:36 PM lo 0.00 0.00 0.00
03:30:36 PM eth2 32.00 2.00 1.44 0.30 0.00 0.00 0.00
03:30:36 PM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s
03:30:37 PM lo 0.00 0.00 0.00
03:30:37 PM eth2 15.15 3.03 0.69 0.56 0.00 0.00 0.00
03:30:37 PM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s
03:30:38 PM lo 0.00 0.00 0.00
03:30:38 PM eth2 30.69 1.98 1.38 0.50 0.00 0.00 0.00
03:30:38 PM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s
03:30:39 PM lo 0.00 0.00 0.00
03:30:39 PM eth2 28.00 2.00 1.26 0.50 0.00 0.00 0.00
Average: IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s
Average: lo 0.00 0.00 0.00
Average: eth2 26.50 2.25 1.19 0.47 0.00 0.00 0.00
Note: the last 1 / 4 of the command means to take the value once per second for a total of 4 times.
Parameter explanation:
IFACE:LAN interface
Rxpck/s: packets received per second
Txpck/s: packets sent per second
RxkB/s: number of kB received per second
TxkB/s: number of kB sent per second
Rxcmp/s: compressed packets received per second
Txcmp/s: compressed packets sent per second
Rxmcst/s: multicast packets received per second
This is the end of the article on "how to check the network card traffic in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.