Because linux traffic monitoring is often performed for Linux, the above three methods can be used to determine the future traffic. note: People think that nload is very powerful and not accurate. device method, please check another white chapter, linux rpm higher governance.
Linux traffic monitoring iftop Tool
Usage: It is used to immediately monitor network channels.
Fulfill (must be root)
Monitor the network card quality of eth1
# Iftop-I eth1
Display traffic with double bits (default non-bits) as the bitkey (bytes ):
$ Iftop-B
The IP address is indirectly displayed, and the DNS system is not entered and ended:
$ Iftop-n
The serial number is indirectly displayed, and no implicit service title is displayed:
$ Iftop-N
Indicates the quality of an enabled packet for an inbound/outbound network segment.
$ Iftop-F 192.168.1.0/24 or 192.168.1.0/255.255.255.0
For other parameters, see iftop-h.
When you enter the iftop image, Do you want to press p to switch non-printable ports? n to switch the hidden IP address or the domain name, ghd MK4 IV Pure of the slave machine, N switch display port code or title, p long stop display, B switch can display a few, B switch to calculate a few seconds out of the uniform streaming, other buttons can follow the h wait and see to clarify.
Linux traffic monitoring nload
Usage: It is used to immediately monitor network channels. The application frequency of each ip address is very wide (it is empty talk)
Nload acquiesce to the eth0 Nic. If you want to monitor the traffic of the eth1 Nic
# Nload eth1
The nload default combination is high and low: the lower half of the door is: Incoming also does not enter the network card traffic, the upper half is: Outgoing, that is, the Incoming traffic from the network card, no subsequent traffic for each part (Curr), Avg for all traffic in the region, Min for the maximum traffic, Max for the minimum traffic), and Ttl for combat traffic, it's still a pretty song.
In addition, you can also define the double bits for the traffic value.
# Nload -- help
Then you can see the detailed coherent parameters.
Check for even network traffic
The above does not properly monitor the even traffic of your network, and you can downgrade the subscription time.
- #!/bin/bash
- echo -n "which nic?"
- read eth
- echo "the nic is "$eth
- echo -n "how much seconds:"
- read sec
- echo "duration is "$sec" seconds, wait please..."
- infirst=$(awk '/'$eth'/{print $1 }' /proc/net/dev |sed 's/'$eth'://')
- outfirst=$(awk '/'$eth'/{print $10 }' /proc/net/dev)
- sumfirst=$(($infirst+$outfirst))
- sleep $sec"s"
- inend=$(awk '/'$eth'/{print $1 }' /proc/net/dev |sed 's/'$eth'://')
- outend=$(awk '/'$eth'/{print $10 }' /proc/net/dev)
- sumend=$(($inend+$outend))
- sum=$(($sumend-$sumfirst))
- echo $sec" seconds total :"$sum"bytes"
- aver=$(($sum/$sec))
- echo "avrage :"$aver"bytes/sec"