How to Monitor Network Traffic on Linux: 11 Essential Tools and Commands
This guide reviews eleven Linux tools and commands—including iptraf, sar, ntop, and tcpdump—for monitoring network traffic, explains installation steps for various distributions, and describes how to interpret their output, helping administrators keep web servers performant and secure.
Monitoring network traffic on Linux is crucial for web servers. Below is a summary of various tools and commands.
1. iptraf
iptraf is a real‑time text‑based network traffic monitor. Install on RHEL from the installation media (iptraf*.rpm) or on CentOS with yum install -y iptraf. Use PuTTY for display; SecureCRT may show garbled characters.
Features include IP traffic monitor, general interface statistics, detailed interface statistics. With the -B option it can run in background and save data to /var/log/iptraf.
2. nload
Not included by default; install from repositories.
3. ifstat
Not included by default; install from repositories.
4. sar (sysstat)
Install on RHEL from the installation media (sysstat*.rpm) or on CentOS with yum install -y sysstat. The sysstat package provides iostat, mpstat, and sar. sar can collect system statistics at intervals.
To monitor network traffic with sar: sar -n DEV interval count where interval is the sampling period in seconds and count is the number of samples (0 means continuous until interrupted). Example: sar -n DEV 1 4 Output fields include IFACE, rxpck/s, txpck/s, rxbyt/s, txbyt/s.
5. /proc/net/dev
Viewing this file directly is not very intuitive.
6. ifconfig
Also not very intuitive for traffic monitoring.
7. iftop
Install and run, e.g., iftop -i eth1.
8. mtr
Install with yum install -y mtr. Text‑based tool.
9. ntop
Provides a web interface and works on Windows as well. Installation guides are available online.
10. tcpdump + command pipeline
Install with yum install -y tcpdump. Example usage:
tcpdump -i eth0 -nv > 111
cat 111 | awk '{print $2}' | cut -d"." -f1-4 | grep 192.168 | sort | uniq -c | sort -rn | head11. vnstat
Simple network traffic statistics tool; see http://wowubuntu.com/vnstat.html for details.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
