You could take a look at netstat
command. Its a simple way to get network status and statistics. A guide on how to use it: http://www.tldp.org/LDP/nag2/x-087-2-iface.netstat.html
You're probably looking for netstat -i
, which will output long-term average networking statistics for all configured interfaces, plus error counters and other useful things.
Alternatively (and a bit less simply), Sar can output a huge range of data and is great for a local measure of "What is happening to X for duration Y".
This is a fair guide on how to use it: http://www.thegeekstuff.com/2011/03/sar-examples
You're looking for section (9) which reads:
- Report network statistics (sar -n)
This reports various network statistics. For example: number of packets received (transmitted) through the network card, statistics of packet failure etc.,. “1 3” reports for every 1 seconds a total of 3 times.
sar -n KEYWORD
KEYWORD can be one of the following:
DEV – Displays network devices vital statistics for eth0, eth1, etc.,
EDEV – Display network device failure statistics
NFS – Displays NFS client activities
NFSD – Displays NFS server activities
SOCK – Displays sockets in use for IPv4
IP – Displays IPv4 network traffic
EIP – Displays IPv4 network errors
ICMP – Displays ICMPv4 network traffic
EICMP – Displays ICMPv4 network errors
TCP – Displays TCPv4 network traffic
ETCP – Displays TCPv4 network errors
UDP – Displays UDPv4 network traffic
SOCK6, IP6, EIP6, ICMP6, UDP6 are for IPv6
ALL – This displays all of the above information. The output will be very long.
Thus, # sar -n DEV 1 2
will report on network devices one every second two times. If you wanted a fair average in a given time frame, you could specify a large "duration" value.