The Modern Linux Networking Toolkit
The old ifconfig, netstat, and route commands are deprecated. Modern Linux uses the iproute2 suite. Here's your complete reference for network troubleshooting and management.
Interface Management with ip
# Show all interfaces
ip addr show
ip a # Short form
# Show specific interface
ip addr show dev eth0
# Add an IP address
ip addr add 192.168.1.100/24 dev eth0
# Remove an IP address
ip addr del 192.168.1.100/24 dev eth0
# Bring interface up/down
ip link set eth0 up
ip link set eth0 down
# Show link statistics
ip -s link show eth0
Routing
# Show routing table
ip route show
ip route get 8.8.8.8 # Which route is used for a destination
# Add a static route
ip route add 10.0.0.0/8 via 192.168.1.1 dev eth0
# Add default gateway
ip route add default via 192.168.1.1
# Delete a route
ip route del 10.0.0.0/8
Socket Statistics with ss
# Show all listening TCP ports
ss -tlnp
# Show established connections
ss -tnp
# Show all UDP sockets
ss -ulnp
# Filter by port
ss -tlnp sport = :443
ss -tnp dport = :3306
# Show socket summary
ss -s
# Show timer information
ss -tnpo
DNS Diagnostics
# Quick DNS lookup
dig google.com +short
dig google.com MX
# Full resolution trace
dig +trace google.com
# Reverse DNS
dig -x 8.8.8.8
# Query specific DNS server
dig @1.1.1.1 google.com
# Check DNS propagation
for ns in 8.8.8.8 1.1.1.1 9.9.9.9; do
echo "=== $ns ===" && dig @$ns example.com +short
done
Packet Analysis
# Capture packets on an interface
tcpdump -i eth0 -n
# Capture specific traffic
tcpdump -i eth0 port 80 -n
tcpdump -i eth0 host 192.168.1.100
# Save capture to file
tcpdump -i eth0 -w capture.pcap -c 1000
# Read capture file
tcpdump -r capture.pcap -n
# Human-readable HTTP traffic
tcpdump -i eth0 -A -s 0 'tcp port 80'
Connectivity Testing
# Trace route to destination
traceroute google.com
mtr google.com # Interactive continuous trace
# Test specific port connectivity
nc -zv google.com 443 # TCP
nc -zuv 8.8.8.8 53 # UDP
# Measure bandwidth
iperf3 -s # Server mode
iperf3 -c server_ip # Client mode
# HTTP testing
curl -I https://linuxprofessional.ie # Headers only
curl -w "DNS: %{time_namelookup}s\nConnect: %{time_connect}s\nTTFB: %{time_starttransfer}s\nTotal: %{time_total}s\n" -o /dev/null -s https://linuxprofessional.ie
These commands form the foundation of network troubleshooting on Linux. Combine them with scripting and you can automate monitoring, alerting, and diagnostics across your entire infrastructure.
Share this article
