HxHippy

Network Troubleshooting

Essential tools and techniques for diagnosing and resolving network issues.

Last updated: 2025-01-15

Network Troubleshooting

A systematic approach to diagnosing network connectivity issues.

Troubleshooting Methodology

1. Identify the problem
2. Establish a theory
3. Test the theory
4. Create an action plan
5. Implement the solution
6. Verify functionality
7. Document findings

Essential Commands

ping - Test Connectivity

# Basic ping
ping google.com

# Limit packets
ping -c 4 192.168.1.1

# Set packet size
ping -s 1500 192.168.1.1

# Continuous with timestamp
ping -D 192.168.1.1

traceroute - Path Analysis

# Standard traceroute
traceroute google.com

# TCP-based (better for firewalls)
traceroute -T -p 443 google.com

# MTR - combines ping and traceroute
mtr google.com

netstat / ss - Connection Status

# All listening ports
ss -tulpn

# Active connections
ss -tan

# Connection statistics
ss -s

# Legacy netstat equivalent
netstat -tulpn

dig / nslookup - DNS Queries

# DNS lookup
dig example.com

# Specific record types
dig example.com MX
dig example.com TXT

# Query specific server
dig @8.8.8.8 example.com

# Reverse lookup
dig -x 8.8.8.8

ip - Interface Configuration

# Show all interfaces
ip addr show

# Show routing table
ip route show

# Show neighbor table
ip neigh show

# Check link status
ip link show

Common Issues and Solutions

No Connectivity

# Check if interface is up
ip link show eth0

# Bring interface up
sudo ip link set eth0 up

# Check IP assignment
ip addr show eth0

# Request DHCP
sudo dhclient eth0

Slow Network

# Check for packet loss
ping -c 100 192.168.1.1 | tail -2

# Test bandwidth
iperf3 -c server.example.com

# Check interface errors
ip -s link show eth0

# Monitor real-time traffic
iftop -i eth0

DNS Issues

# Check DNS configuration
cat /etc/resolv.conf

# Test DNS resolution
dig example.com +short

# Clear DNS cache (systemd)
sudo systemd-resolve --flush-caches

# Test with different servers
dig @1.1.1.1 example.com
dig @8.8.8.8 example.com

Port Connectivity

# Check if port is open
nc -zv 192.168.1.1 22

# Test multiple ports
nc -zv 192.168.1.1 20-25

# Check listening services
ss -tulpn | grep :80

Packet Capture

# Basic capture
sudo tcpdump -i eth0

# Capture specific port
sudo tcpdump -i eth0 port 80

# Save to file
sudo tcpdump -i eth0 -w capture.pcap

# Read capture file
tcpdump -r capture.pcap

Network Diagnostic Checklist

[ ] Physical layer - cables, link lights
[ ] IP configuration - correct address/mask
[ ] Gateway - can ping default gateway
[ ] DNS - resolution working
[ ] Firewall - rules not blocking
[ ] Service - application listening
[ ] Remote - target service running

Best Practices

  1. Start at Layer 1 - Check physical first
  2. Test locally first - Ping localhost, then gateway
  3. Check logs - System and application logs
  4. Document changes - What changed recently
  5. Use multiple tools - Cross-verify findings
beginner Fundamentals Updated 2025-01-15
  • troubleshooting
  • ping
  • traceroute
  • netstat
  • network diagnostics
  • connectivity