In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is to share with you about how to view network card traffic in linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Method 1. Nload tool
Source package path:
Http://heanet.dl.sourceforge.net/project/nload/nload/0.7.2/nload-0.7.2.tar.gz
View the parameter help command:
Nload-help
-a: this seems to be the refresh time period of all data, in seconds. The default is 300.
-I: set the maximum display ratio of the traffic graph entering the network card. Default is 10240 kBit/s.
-m: no traffic graph is displayed, only statistics are displayed.
-o: the maximum display ratio of the traffic graph of the outgoing network card. Default is 10240 kBit/s.
-t: displays the refresh interval of the data, in milliseconds. The default is 500.
-u: sets the data units of Curr, Avg, Min and Max on the right. The default is automatic. Pay attention to the different case units!
H | b | k | m | g h: auto, b: Bit/s, k: kBit/s, m: MBit/s etc.
H | B | K | M | G H: auto, B: Byte/s, K: kByte/s, M: MByte/s etc.
-U: sets the data unit of the Ttl on the right, which changes automatically by default. Note that the case units are different (same as-u)!
Devices: custom monitoring network card, which is all monitored by default. Use the left and right keys to switch.
For example, only monitor eth0 command: nload eth0
Method 2. Iftop tool
Source package path:
Http://www.ex-parrot.com/%7Epdw/iftop/download/iftop-0.17.tar.gz
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, this is a translated statement, I have not used this!
Press! You can use the Shell command, this is not used! I don't understand what orders work here!
Press Q to exit the monitoring.
Method 3. Ifstat
Source package path:
Http://gael.roualland.free.fr/ifstat/ifstat-1.1.tar.gz
Parameters:
-a monitor the status information of all network interfaces that can be detected
-z hides interfaces where traffic is zero, such as those interfaces that are enabled but not used
-I specify the interface to monitor, followed by the name of the network interface
Time:
-T reports the full bandwidth of all monitoring interfaces
-w uses the specified column width instead of automatically magnifying the column width to accommodate the length of the interface name
-W automatic line wrapping if the content is wider than the width of the terminal window
-b display bandwidth in kbits/s instead of kbytes/s
Method 4.
Iptraf
Installation method:
Yum-y install iptraf
Iptraf is an IP LAN monitoring tool based on ncurses. It can monitor network card traffic in real time and generate all kinds of network statistics, including TCP information, UDP statistics, ICMP and OSPF information, Ethernet load information, node statistics, IP checksum errors and other information.
Parameter list for iptraf
Adding different parameters after iptraf can play a different role. The following is a list of parameter commands for iptraf:
Parameter command function-I iface network interface: immediately enable IP traffic monitoring on the specified network interface. If iface is all, it means to monitor all network interfaces. Iface means that the corresponding interface-g immediately starts to generate summary status information of the network interface-d iface network interface: immediately starts monitoring detailed network traffic information on the specified network interface, iface refers to the corresponding interface-s iface network interface: immediately starts monitoring TCP and UDP network traffic information on the specified network interface, and iface refers to the corresponding interface-z iface network interface: displays the packet count on the specified network interface. Iface refers to the corresponding interface-l iface network interface: start monitoring LAN workstation information immediately on the specified network interface, and iface refers to the corresponding interface-t timeout time: specify the time to be monitored by the iptraf instruction Timeout refers to the number of minute for monitoring time-B redirects the annotation output to "/ dev/null", turns off the annotation input, and runs the program as a background process-L logfile specifies a file to record all command line log. The default file is the address: / var/log/iptraf-I interval specifies the interval between recording log (in minute) Excluding IP traffic monitor-u allows unsupported interfaces to be used as Ethernet devices-f clear all counters-h display help information
Method 5. Watch ifconfig
The watch command can execute a command repeatedly, with a default interval of 2 seconds.
Watch ifconfig can monitor network status every two seconds,
Watch-d ifconfig can monitor the status of the network every two seconds and mark parts that have changed
Watch-d ifconfig eth0 can only monitor the network card eth0 every two seconds and mark the parts that have changed.
Watch-d'ifconfig eth0 | grep bytes' can only monitor the Nic eth0 every other second, show only the part of the traffic, and mark the parts that have changed
Watch can also be used to view file changes, such as:
For example, watch ls-la file, this command means to see how the file size of file1 changes in two seconds.
Exit: ctrl+c
Detailed explanation of watch command
NAME
Watch-execute a program periodically, showing output fullscreen
SYNOPSIS
Watch [- dhvt] [- n] [--differences [= cumulative]] [--help] [--interval=] [--no-title] [--version]
DESCRIPTION
Watch runs command repeatedly, displaying its output (the first screenfull). This allows you to watch the program output change over time. By default, the program is run every 2 seconds; use-n or-- interval to specify a different interval.
The-d or-- differences flag will highlight the differences between successive updates. The-cumulative option makes highlighting "sticky", presenting a running display of all positions that have ever changed. The-t or-no-title option turns off the header showing the interval, command, and current time at the top of the display, as well as the following blank line. Watch will run until interrupted.
NOTE
Note that command is given to "sh-c" which means that you may need to use extra quoting to get the desired effect.
Note that POSIX option processing is used (i.e., option processing stops at the first non-option argument). This means that flags after command don't get interpreted by watch itself.
EXAMPLES
To watch for mail, you might do: watch-n 60 from
To watch the contents of a directory change, you could use: watch-d ls-l
If youre only interested in files owned by user joe, you might use: watch-d'ls-l | fgrep joe'
You can watch for your administrator to install the latest kernel with: watch uname-r (Just kidding.) He he
BUGS
Upon terminal resize, the screen will not be correctly repainted until the next scheduled update. All-- differences highlighting is lost on that update as well.
Non-printing characters are stripped from program output. Use "cat-v" as part of the command pipeline if you want to see them.
Method 6.
Watch cat / proc/net/dev
Thank you for reading! This is the end of the article on "how to check 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, you can 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.