Skip to content

Network Troubleshooting Tools

Network troubleshooting is a critical skill for DevOps engineers. These tools help diagnose connectivity issues, performance problems, and service availability.

Ping - Connectivity Testing

tldr: ping

Send ICMP ECHO_REQUEST packets to network hosts. See also: mtr.

# Ping a host
ping <host>

# Limit to a specific number of packets
ping -c <count> <host>

# Set interval between requests (seconds; default 1)
ping -i <seconds> <host>

# Suppress DNS hostname lookups
ping -n <host>

# Also display a message if no response was received
ping -O <host>

# IPv6 — ping all local-network hosts
ping -6 ff02::1%eth0

More info: https://manned.org/ping

Ping tests basic network connectivity and measures round-trip time to a destination.

Understanding Ping

Comprehensive guide explaining ping functionality, parameters, and interpretation of results.

Common Ping Usage

# Basic connectivity test
ping google.com

# Send specific number of packets
ping -c 4 google.com

# Set packet interval (seconds)
ping -i 2 google.com

# Flood ping (requires root)
sudo ping -f target-host

# IPv6 ping
ping6 ipv6.google.com

Telnet - Port Connectivity Testing

tldr: telnet

Connect to a specified port of a host using the telnet protocol.

# Connect to default port of a host
telnet <host>

# Connect to a specific port (common use: test if port is open)
telnet <ip_address> <port>

# Exit an interactive session
quit

# Send the escape character to terminate the session
# Press: Ctrl+]

More info: https://manned.org/telnet

Telnet is invaluable for testing if specific ports are open and accessible on remote hosts.

Telnet Resources

Complete guide to telnet usage and practical examples.

Practical troubleshooting scenarios using telnet for various protocols.

Telnet Usage Examples

# Test HTTP port
telnet google.com 80

# Test HTTPS port  
telnet google.com 443

# Test SSH port
telnet server.example.com 22

# Test SMTP port
telnet mail.example.com 25

# Test custom application port
telnet app-server.local 8080

cURL - HTTP/API Testing

tldr: curl

Transfer data from or to a server. Supports HTTP, HTTPS, FTP, SCP, and more.

# GET request
curl https://example.com

# Follow redirects and dump response headers
curl -L -D - https://example.com

# Download a file using the remote filename
curl -O https://example.com/filename.zip

# POST JSON data
curl -X POST -d '{"name":"bob"}' -H 'Content-Type: application/json' http://example.com/users

# Pass a bearer token header
curl -H 'Authorization: Bearer <token>' https://example.com

# Verbose output (TLS handshake, headers, timing)
curl -v https://example.com

# Test through a proxy (e.g. Burp Suite)
curl -x http://127.0.0.1:8080 https://example.com

More info: https://curl.se/docs/manpage.html

cURL is essential for testing web services, APIs, and HTTP-based applications.

cURL Resources

Comprehensive guide covering API testing and troubleshooting with cURL.

cURL Examples

# Basic GET request
curl https://api.example.com/users

# GET with headers
curl -H "Authorization: Bearer token123" https://api.example.com/data

# POST request with JSON data
curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"username":"test","password":"secret"}' \
  https://api.example.com/login

# Download file
curl -O https://example.com/file.zip

# Follow redirects
curl -L https://bit.ly/shortened-url

# Save response headers
curl -I https://example.com

# Test with different user agents
curl -A "Mozilla/5.0" https://example.com

# Upload file
curl -F "file=@document.pdf" https://upload.example.com

# Basic authentication
curl -u username:password https://protected.example.com

Additional Network Tools

Comprehensive Network Troubleshooting

Complete reference for network troubleshooting commands and utilities.

Quick Reference (tldr)

tldr: ip

Show and manipulate routing, devices, policy routing, and tunnels.

ip address                          # Show all network interfaces
ip addr show eth0                   # Show info for a specific interface
ip -br address                      # Brief summary of all interfaces
ip route show                       # Show routing table
ip route add default via <gateway>  # Add a default route
ip link set eth0 up                 # Bring an interface up
ip neighbor                         # Show ARP/neighbor table
tldr: ss

Utility to investigate sockets — modern replacement for netstat.

ss -tuln                   # All listening TCP/UDP ports (no DNS)
ss -lt src :8080           # TCP sockets listening on port 8080
ss -pt dst :ssh            # Processes connected to SSH port
ss state established       # All established connections
ss -K dst <ip>             # Kill socket connections to an IP
tldr: netstat

Display open connections, socket ports, and routing information.

netstat -a                 # List all ports
netstat -l                 # List all listening ports
netstat -tulpn             # TCP/UDP listening ports with PID (run as root)
netstat -rn                # Show routing table (no hostname resolution)
tldr: lsof

List open files and the corresponding processes.

lsof -i :80                # Find process using port 80
lsof -i6TCP:<port> -sTCP:LISTEN -n -P  # IPv6 TCP listener on port
lsof -u <username>         # Files opened by a user
lsof -p <pid>              # Files opened by a process
lsof +D /path/to/dir       # Open files in a directory
tldr: dig

DNS lookup utility.

dig example.com            # A records (with full output)
dig +short example.com     # IP addresses only
dig example.com MX         # Query a specific record type
dig @8.8.8.8 example.com   # Query a specific DNS server
dig -x 8.8.8.8             # Reverse lookup (PTR record)
dig +trace example.com     # Full iterative trace from root servers
dig +tcp example.com       # Force TCP instead of UDP
tldr: nslookup

Query name servers for various domain records.

nslookup example.com                   # Default A record lookup
nslookup -type=MX example.com          # MX records
nslookup -type=NS example.com 8.8.8.8  # NS records via specific server
nslookup -type=PTR 8.8.8.8             # Reverse lookup
nslookup -type=ANY example.com         # All available records
tldr: host

Simple DNS lookup. See also: dig, nslookup.

host example.com             # A, AAAA, and MX records
host -t CNAME example.com    # Specific record type
host 8.8.8.8                 # Reverse lookup
host example.com 8.8.8.8     # Use a specific DNS server
tldr: traceroute

Print the route packets take to a network host. See also: mtr.

traceroute example.com       # Trace route to host
traceroute -n example.com    # No hostname resolution (faster)
traceroute -I example.com    # Use ICMP instead of UDP
traceroute -w 0.5 example.com  # 0.5 s wait per hop
traceroute --mtu example.com   # Determine path MTU
tldr: mtr

Matt's Traceroute: combined traceroute + continuous ping. See also: traceroute, ping.

mtr example.com              # Live trace with per-hop loss/latency
mtr -n example.com           # No DNS resolution
mtr -w example.com           # Wide report (10 pings per hop, then exit)
mtr -z example.com           # Show Autonomous System Number per hop
mtr -4 example.com           # Force IPv4
mtr -i 10 example.com        # 10-second interval between probes
tldr: iperf3

Traffic generator for testing network bandwidth.

iperf3 -s                    # Run as a server (wait for connections)
iperf3 -s -p <port>          # Server on a specific port
iperf3 -c <server_ip>        # Run bandwidth test to server
iperf3 -c <server_ip> -P 4   # 4 parallel streams
iperf3 -c <server_ip> -R     # Reverse direction (server → client)
iperf3 -c <server_ip> -t 30  # Test for 30 seconds
tldr: tcpdump

Capture and dump network traffic.

sudo tcpdump -D                                  # List available interfaces
sudo tcpdump -i eth0                             # Capture on eth0
sudo tcpdump host example.com                    # Filter by host
sudo tcpdump port 443                            # Filter by port
sudo tcpdump src 192.168.1.1 and dst port 80    # Source + destination filter
sudo tcpdump -w dump.pcap port not 22            # Write to file (exclude SSH)
tcpdump -r dump.pcap                             # Read and replay a capture file
tldr: nmap

Network exploration tool and port scanner.

nmap <host>                  # Scan top 1000 TCP ports
nmap -p 22,80,443 <host>     # Scan specific ports
nmap -p- <host>              # Scan all 65535 ports
nmap -sn 192.168.0.0/24      # Ping sweep — host discovery only
nmap -sV <host>              # Service and version detection
sudo nmap -A <host>          # OS + version + scripts + traceroute
tldr: nc (netcat)

Redirect I/O into a network stream.

nc -zv <host> 80-443         # Scan a port range (verbose)
nc -l -p <port>              # Start a TCP listener
nc <host> <port>             # Connect to a host:port
nc < file -l -p <port>       # Send a file via listener
nc <host> <port> > out.file  # Receive a file from a listener
nc -l -p <port> | nc <host> <remote_port>  # Simple TCP proxy

Essential Network Commands

# Network interface information
ip addr show                 # Show all interfaces
ip route show               # Show routing table
ifconfig                    # Legacy interface configuration

# DNS troubleshooting
nslookup domain.com         # DNS lookup
dig domain.com             # Detailed DNS information
host domain.com            # Simple DNS lookup

# Network connections
netstat -tuln              # Show listening ports
ss -tuln                   # Modern replacement for netstat
lsof -i :80               # Show processes using port 80

# Network performance
traceroute google.com      # Trace packet route
mtr google.com            # Continuous traceroute
iperf3 -s                 # Network performance testing

# Packet analysis
tcpdump -i eth0           # Capture network packets
wireshark                 # GUI packet analyzer

# Network scanning
nmap -sT target-host      # TCP port scan
nc -zv host 80-443       # Port range scanning with netcat

Troubleshooting Methodology

Systematic Approach

  1. Layer 1 - Physical: Check cables, hardware status
  2. Layer 2 - Data Link: Verify interface status, VLAN configuration
  3. Layer 3 - Network: Test IP connectivity, routing
  4. Layer 4 - Transport: Verify port accessibility, firewall rules
  5. Layer 7 - Application: Test application-specific functionality

Common Network Issues

IssueSymptomsTools to UseTypical Causes
No ConnectivityCannot reach hostping, tracerouteNetwork down, wrong IP, firewall
DNS ProblemsCan ping IP but not hostnamenslookup, digDNS server issues, wrong configuration
Port BlockedConnection refusedtelnet, nmapFirewall, service not running
Slow PerformanceHigh latency, timeoutsmtr, iperf3Network congestion, routing issues
SSL/TLS IssuesCertificate errorscurl -v, opensslCertificate problems, wrong configuration

DevOps-Specific Scenarios

Container Networking

# Test container connectivity
docker exec container-name ping host.docker.internal

# Check container port mapping
docker port container-name

# Network troubleshooting in Kubernetes
kubectl exec -it pod-name -- ping service-name
kubectl describe service service-name

Load Balancer Testing

# Test load balancer endpoints
for i in {1..10}; do curl -s http://load-balancer.example.com | grep server; done

# Check SSL certificate
curl -vI https://load-balancer.example.com 2>&1 | grep -E "(Server|SSL|TLS)"

# Test with specific headers
curl -H "Host: backend.internal" http://load-balancer-ip/

Monitoring Integration

# Health check scripts
#!/bin/bash
if ping -c 1 target-host &> /dev/null; then
    echo "Host is reachable"
    exit 0
else
    echo "Host is unreachable"
    exit 1
fi

# Service availability check
#!/bin/bash  
if curl -f -s http://service-endpoint/health; then
    echo "Service is healthy"
else
    echo "Service is unhealthy"
    exit 1
fi

Next Steps

Master these troubleshooting tools, then move on to:

Best Practices

  • Always start with basic connectivity (ping)
  • Document your troubleshooting steps
  • Use verbose modes (-v) for detailed output
  • Combine multiple tools for comprehensive diagnosis
  • Automate repetitive troubleshooting tasks

Security Considerations

  • Some tools require elevated privileges
  • Be careful with network scanning in production
  • Respect rate limits when testing APIs
  • Follow your organization's security policies