# netstat -rn -f inet Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 0.0.0.0 10.7.28.23 0.0.0.0 UG 0 0 0 vlan28 10.7.1.1 10.7.3.7 255.255.255.255 UGH 0 0 0 enp14s0f2 10.7.1.2 10.7.3.4 255.255.255.255 UGH 0 0 0 enp14s0f3 10.7.1.33 10.7.28.23 255.255.255.255 UGH 0 0 0 vlan28 10.7.1.34 10.7.28.23 255.255.255.255 UGH 0 0 0 vlan28 10.7.1.41 10.7.3.7 255.255.255.255 UGH 0 0 0 enp14s0f2 .....
# ls -l /sys/class/net total 0 lrwxrwxrwx 1 root root 0 Mar 8 04:06 bond0 -> ../../devices/virtual/net/bond0 -rw-r--r-- 1 root root 4096 Mar 8 04:05 bonding_masters lrwxrwxrwx 1 root root 0 Mar 8 04:06 enp12s0f0 -> ../../devices/pci0000:00/0000:00:03.1/0000:0c:00.0/net/enp12s0f0 lrwxrwxrwx 1 root root 0 Mar 8 04:06 enp12s0f1 -> ../../devices/pci0000:00/0000:00:03.1/0000:0c:00.1/net/enp12s0f1 lrwxrwxrwx 1 root root 0 Mar 8 04:06 enp12s0f2 -> ../../devices/pci0000:00/0000:00:03.1/0000:0c:00.2/net/enp12s0f2 lrwxrwxrwx 1 root root 0 Mar 8 04:06 enp12s0f3 -> ../../devices/pci0000:00/0000:00:03.1/0000:0c:00.3/net/enp12s0f3 lrwxrwxrwx 1 root root 0 Mar 8 04:05 enp14s0f0 -> ../../devices/pci0000:00/0000:00:03.2/0000:0e:00.0/net/enp14s0f0 lrwxrwxrwx 1 root root 0 Mar 8 04:05 lo -> ../../devices/virtual/net/lo lrwxrwxrwx 1 root root 0 Mar 8 04:05 ovsbr0 -> ../../devices/virtual/net/ovsbr0 lrwxrwxrwx 1 root root 0 Mar 8 04:06 ovs-system -> ../../devices/virtual/net/ovs-system lrwxrwxrwx 1 root root 0 Mar 8 04:05 vlan19 -> ../../devices/virtual/net/vlan19
# cat /sys/class/net/enp8s0f0/statistics/tx_bytes 308623980
# netstat -rn Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 10.9.0.0 10.9.2.32 255.255.255.0 UG 0 0 0 enp1s0 10.9.1.1 10.9.2.32 255.255.255.255 UGH 0 0 0 enp1s0
ss -ntl
# nstat -a #kernel IpInReceives 156764 0.0 IpInDelivers 156764 0.0 IpOutRequests 151083 0.0 IpOutNoRoutes 40 0.0 .....
- netstat --statistics
- netstat -s -- protocol stats
- netstat -r -- routing info from kernel
- netstat -g -- mulicast info
- netstat -i -- stats
- netstat -ic -- monitor continuously
- netstat -e -- extra information
- netstat -o -- timer related information
- netstat -p -- associated PID
- netstat -l -- listening sockets
- ss --summary
Useful combinations:
- netstat -antp
- netstat -lntp
- nload - console based histogram
- iftop - console based numeric traffic values
- iptraf - An IP traffic monitor that shows information on the IP traffic passing over your network.
- iptraf-ng - is a fork of the original project
- dstat - Combines vmstat, iostat, ifstat, netstat information and more
- sar
- Diagnostics
- strace -e open nstat 2>&1 > /dev/null|grep /proc
- strace -e open netstat -s 2>&1 > /dev/null|grep /proc