Linux Network Monitoring with Iptraf/Iptraf-ng
How to Install and Setup Iptraf
Before we start using Iptraf, we need to install and set it up. Iptraf is available in most Linux distributions, so you can install it using your distribution’s package manager. For example, in Ubuntu, you can install Iptraf using the following command:
sudo apt-get install iptraf
yum install iptraf iptraf-ng
Once Iptraf is installed, you can launch it by typing the following command in the terminal:
sudo iptraf
This will launch the Iptraf interface, from where you can start monitoring your network.
How to Use Iptraf to Monitor Network Traffic and Bandwidth
Viewing all network card traffic
iptraf -g
## or
iptraf-ng -g
View traffic traffic on each port of a certain network card
iptraf -s eth0
iptraf-ng 1.1.4
l Proto/Port q Pkts q Bytes q PktsTo qqqqqq BytesTo qqqqq PktsFrom qqqq BytesFrom qk
x UDP/68 4 1336 0 0258 4 85334 16 6064 242 79270
x UDP/67 4 258 85334 4 242 79270 0 160 6064
x UDP/546 1 57 7406 0 0 1 157 7406
x UDP/547 1 57 7406 1 57 7406 0 0
x UDP/53 4 140 16032 2 70 4604 2 70 398 11428
x TCP/80 1 512 80181599 1 274 80 41926 0 238 139673
x TCP/443 1 561 80311332 1 297 80 38195 0 264 273137
x UDP/137 2 308 24024 1 154 78 12012 78 154 12012
x UDP/123 1 4 76 304 1 2 76 152 0 2 152
x TCP/23 2 80 1 40 1 40
x TCP/445 2 6 92 272 1 3 52 152 40 3 12
Classify traffic traffic by protocol
iptraf -d eth0
Filter by remote host port
iptraf -i eth0
Linux network related commands
ifconfig
ifup/ifdown
route -n
ip link show
traceroute
netstat
host imzye.com
ping
route
nslookup
dig
finger
lsof
Reference
http://iptraf.seul.org/
https://github.com/iptraf-ng/iptraf-ng
https://man7.org/linux/man-pages/man8/iptraf-ng.8.html
https://www.tecmint.com/iptraf-ng-linux-network-monitoring/