Network_monitoring
Chapter 18: Network Monitoring
Section titled “Chapter 18: Network Monitoring”18.1 Introduction to Network Monitoring
Section titled “18.1 Introduction to Network Monitoring”Network monitoring involves tracking network performance, availability, and security.
Network Monitoring Overview+------------------------------------------------------------------+
Why Monitor?+------------------------------------------------------------------+| - Detect issues before users notice || - Plan capacity || - Troubleshoot problems || - Security detection || - Performance optimization |+------------------------------------------------------------------+
What to Monitor:+------------------------------------------------------------------+| - Bandwidth utilization || - Latency || - Packet loss || - CPU/Memory of network devices || - Service availability || - Error rates || - Security events |+------------------------------------------------------------------+
Monitoring Types:+------------------------------------------------------------------+| Type | Description ||----------------|--------------------------------------------------|| Active | Sends probes/tests || Passive | Monitors existing traffic || Real-time | Live data || Historical | Long-term trends |+------------------------------------------------------------------+
+------------------------------------------------------------------+18.2 Basic Network Tools
Section titled “18.2 Basic Network Tools”# Basic pingping 8.8.8.8ping google.com
# Continuous pingping -c 10 8.8.8.8
# Interval (seconds)ping -i 0.2 8.8.8.8
# Flood ping (requires root)sudo ping -f 8.8.8.8
# Packet sizeping -s 1000 8.8.8.8
# IPv6ping -6 ipv6.google.comtraceroute / tracepath
Section titled “traceroute / tracepath”# Trace routetraceroute 8.8.8.8tracepath 8.8.8.8
# IPv6traceroute -6 ipv6.google.com
# Don't resolve hostnamestraceroute -n 8.8.8.8
# Set probestraceroute -q 1 8.8.8.8
# Use ICMPtraceroute -I 8.8.8.8mtr (My Traceroute)
Section titled “mtr (My Traceroute)”# Interactive traceroute with statisticsmtr 8.8.8.8
# Report modemtr -c 10 -r 8.8.8.8
# CSV outputmtr -c 10 --csv 8.8.8.8
# No DNS resolutionmtr -n 8.8.8.818.3 Network Statistics
Section titled “18.3 Network Statistics”netstat / ss
Section titled “netstat / ss”# View all connectionsss -tunapnetstat -tunap
# Show listening portsss -tulnpnetstat -tulnp
# Show routing tabless -rnetstat -r
# Show statisticsss -snetstat -s
# TCP connectionsss -tn
# UDP socketsss -unifstat / nload
Section titled “ifstat / nload”# Installsudo pacman -S ifstat nload
# Network interface statisticsifstat -i eth0
# Continuous monitoringnload
# Specific interfacenload eth0
# Show all interfacesnload -m18.4 Packet Capture
Section titled “18.4 Packet Capture”tcpdump
Section titled “tcpdump”# Installsudo pacman -S tcpdump
# Capture on interfacesudo tcpdump -i eth0
# Capture specific hostsudo tcpdump host 192.168.1.1
# Capture specific portsudo tcpdump port 80sudo tcpdump port 443
# Capture specific protocolsudo tcpdump icmpsudo tcpdump tcp
# Capture with packet contentsudo tcpdump -X -i eth0
# Capture specific number of packetssudo tcpdump -c 100 -i eth0
# Write to filesudo tcpdump -w capture.pcap -i eth0
# Read from filetcpdump -r capture.pcap
# Filter by source/destsudo tcpdump src 192.168.1.10sudo tcpdump dst 8.8.8.8
# Combine filterssudo tcpdump -i eth0 host 192.168.1.10 and port 80tshark (Wireshark CLI)
Section titled “tshark (Wireshark CLI)”# Installsudo pacman -S wireshark-cli
# Capture packetssudo tshark -i eth0
# Filter capturesudo tshark -i eth0 tcp.port == 80
# Write to filesudo tshark -w capture.pcap
# Read from filetshark -r capture.pcap
# Extract specific fieldstshark -r capture.pcap -e ip.src -e ip.dst -T fields18.5 Bandwidth Testing
Section titled “18.5 Bandwidth Testing”speedtest-cli
Section titled “speedtest-cli”# Installsudo pacman -S speedtest-cli
# Run testspeedtest-cli
# Simple outputspeedtest-cli --simple
# Share results (image URL)speedtest-cli --share# Installsudo pacman -S iperf
# Server (on one machine)iperf -s
# Client (from another machine)iperf -c <server-ip>
# TCP bandwidth testiperf -c 192.168.1.1
# UDP testiperf -u -c 192.168.1.1
# Bi-directional testiperf -c 192.168.1.1 -d
# Parallel streamsiperf -c 192.168.1.1 -P 418.6 Network Monitoring Tools
Section titled “18.6 Network Monitoring Tools”nmap (Network Scanner)
Section titled “nmap (Network Scanner)”# Installsudo pacman -S nmap
# Scan single hostnmap 192.168.1.1
# Scan networknmap 192.168.1.0/24
# Service version detectionnmap -sV 192.168.1.1
# OS detectionnmap -O 192.168.1.1
# Scan portsnmap -p 80,443 192.168.1.1nmap -p- 192.168.1.1
# Common ports scannmap --top-ports 20 192.168.1.1
# Aggressive scannmap -A 192.168.1.1
# No ping (skip discovery)nmap -Pn 192.168.1.1netcat
Section titled “netcat”# Test port connectivitync -zv 192.168.1.1 80
# Port scannernc -zv 192.168.1.1 20-100
# Chat servernc -l -p 12345
# Connect to chat servernc <server-ip> 12345
# File transfernc -l -p 12345 > file.txt # Receivernc <receiver-ip> 12345 < file.txt # Sender18.7 System Monitoring
Section titled “18.7 System Monitoring”htop / nmon
Section titled “htop / nmon”# Installsudo pacman -S htop nmon
# Runhtopnmon
# Network-specificnmon -n/proc/net/*
Section titled “/proc/net/*”# Network statisticscat /proc/net/snmpcat /proc/net/netstat
# Wireless statscat /proc/net/wireless
# Network interfacescat /proc/net/dev18.8 Network Monitoring Systems
Section titled “18.8 Network Monitoring Systems” Monitoring Tools+------------------------------------------------------------------+
| Tool | Type | Description ||-------------|---------------|--------------------------------------|| Nagios | Infrastructure| Classic monitoring || Zabbix | Infrastructure| Enterprise monitoring || Prometheus | Metrics | Modern time-series DB || Grafana | Visualization | Dashboards || Cacti | SNMP | Graphing || SmokePing | Latency | RRD-based latency monitor || Wireshark | Packet Analysis| Network analyzer |+------------------------------------------------------------------+
Simple Prometheus + Grafana Setup:+------------------------------------------------------------------+
# Run Prometheusdocker run -d --name=prometheus -p 9090:9090 \ -v /etc/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml \ prom/prometheus
# prometheus.ymlglobal: scrape_interval: 15s
scrape_configs: - job_name: 'node' static_configs: - targets: ['localhost:9100']
# Install node_exportersudo pacman -S node_exportersudo systemctl enable node_exportersudo systemctl start node_exporter
# Run Grafanadocker run -d --name=grafana -p 3000:3000 grafana/grafana
# Access Grafana at http://localhost:3000# Add Prometheus datasource# Import dashboard (Node Exporter)
+------------------------------------------------------------------+
+------------------------------------------------------------------+Summary
Section titled “Summary”In this chapter, you learned:
- ✅ Basic network tools (ping, traceroute, mtr)
- ✅ Network statistics (netstat, ss)
- ✅ Packet capture (tcpdump, tshark)
- ✅ Bandwidth testing (speedtest, iperf)
- ✅ Network scanning (nmap, netcat)
- ✅ System monitoring (/proc)
- ✅ Monitoring systems (Prometheus, Grafana)
Next Chapter
Section titled “Next Chapter”Last Updated: February 2026