Skip to Content

Network Debugging Commands

ip Command

ip replaces the legacy ifconfig command.

CommandDescription
ip link showShow all network interfaces
ip addr showShow IP addresses
ip -4 addr showShow IPv4 addresses only
ip -6 addr showShow IPv6 addresses only
ip route showShow routing table
ip route get 8.8.8.8Show route to a specific IP
sudo ip link set enp0s3 upEnable a network interface
sudo ip link set enp0s3 downDisable a network interface
sudo ip addr add 192.168.1.100/24 dev enp0s3Temporarily add an IP
sudo ip route add 10.0.0.0/8 via 192.168.1.1Temporarily add a route
ip neigh showShow neighbor table (ARP)

ss Command

ss replaces the legacy netstat command. Flags: -t TCP, -u UDP, -l listening, -n no name resolution, -p show process.

CommandDescription
ss -tlnpShow all listening ports
ss -tnpShow all TCP connections
ss -ulnpShow all UDP ports
ss -tlnp | grep :80Check a specific port
ss -tlnp sport = :443Filter by port number
ss -sShow connection statistics
ss -tnp | grep process-nameShow network connections for a process

ping

CommandDescription
ping -c 4 8.8.8.8Test connectivity
ping -c 10 -i 0.5 -s 1400 target-IPSpecify count, interval, and packet size
ping6 ::1IPv6 ping
ping -c 1 -W 1 192.168.1.1 && echo "online" || echo "offline"Quick host online check

traceroute / tracepath

CommandDescription
traceroute www.example.comTrace route path
sudo traceroute -I www.example.comTrace using ICMP
sudo traceroute -T -p 80 www.example.comTrace using TCP (firewall penetration)
tracepath www.example.comTrace route (no root required)
mtr www.example.comCombined ping + traceroute (install mtr-tiny)

dig / nslookup

CommandDescription
dig www.example.comDNS lookup
dig +short www.example.comShort output
dig MX example.comQuery MX records
dig AAAA www.example.comQuery IPv6 records
dig NS example.comQuery name servers
dig TXT example.comQuery TXT records
dig @8.8.8.8 www.example.comQuery using a specific DNS server
dig -x 8.8.8.8Reverse lookup
nslookup www.example.comSimple DNS lookup
nslookup www.example.com 8.8.8.8Specify DNS server

curl

CommandDescription
curl https://www.example.comGET request
curl -I https://www.example.comShow response headers
curl -v https://www.example.comShow verbose information
curl -o /dev/null -s -w "%{http_code}\n" https://www.example.comShow HTTP status code only
curl -X POST -d "key=value" https://api.example.comPOST request
curl -X POST -H "Content-Type: application/json" -d '{"key":"value"}' https://api.example.comJSON POST
curl -O https://example.com/file.zipDownload file (keep original name)
curl -o newname.zip https://example.com/file.zipDownload file (custom name)
curl -o /dev/null -s -w "DNS: %{time_namelookup}s\nConnect: %{time_connect}s\nTTFB: %{time_starttransfer}s\nTotal: %{time_total}s\n" https://www.example.comTest connection timing
curl -x http://proxy:8080 https://www.example.comRequest through proxy

wget

CommandDescription
wget https://example.com/file.zipDownload file
wget -c https://example.com/large-file.isoResume interrupted download
wget -b https://example.com/large-file.isoBackground download
wget --limit-rate=1M https://example.com/file.zipRate-limited download

NetworkManager Commands

CommandDescription
nmcli general statusCheck connection status
nmcli connection showShow all connections
nmcli device wifi listList Wi-Fi networks
nmcli device statusShow device status
sudo systemctl restart NetworkManagerRestart networking

Firewall Debugging

CommandDescription
sudo ufw status verboseUFW status
sudo iptables -L -n -viptables rules
sudo nft list rulesetnftables rules

Comprehensive Troubleshooting Flow

StepCommandDescription
1ip link showCheck if interface is up
2ip addr showCheck IP address
3ip route showCheck gateway
4ping -c 2 gateway-IPTest gateway connectivity
5ping -c 2 8.8.8.8Test internet connectivity
6dig www.example.comTest DNS
7curl -I https://www.example.comTest HTTP
Last updated on