Skip to content

Networking Cheat Sheet

A short operational cheat sheet for network troubleshooting on Linux.

Interfaces and Addressing

ip a
ip link
ip addr show dev eth0
ip -br a
hostname -I
nmcli device status

Routes

ip r
ip route get 8.8.8.8
ip route add 10.10.0.0/16 via 192.168.1.1
ip route del 10.10.0.0/16

Sockets and Ports

ss -tulpn
ss -tan
ss -lun
lsof -i :80

Reachability Checks

ping -c 4 1.1.1.1
ping -c 4 google.com
traceroute 8.8.8.8
mtr 8.8.8.8
curl -I https://example.com
nc -vz host 443
telnet host 25

DNS

dig example.com
dig A example.com +short
dig MX example.com +short
dig @1.1.1.1 example.com
dig +trace example.com
host example.com
nslookup example.com
resolvectl status

Packet Capture

tcpdump -i eth0
tcpdump -i eth0 port 53
tcpdump -i any host 10.0.0.10
tcpdump -nn -i eth0 tcp port 443

Firewall

ufw status
firewall-cmd --list-all
iptables -L -n -v
nft list ruleset

Debug One-Liners

curl -vk https://example.com
openssl s_client -connect example.com:443 -servername example.com
ip neigh
arp -an
ethtool eth0

Quick Troubleshooting Flow

  1. Is the interface up?
  2. Is there a valid IP and route?
  3. Can you reach the gateway?
  4. Does DNS work?
  5. Is the required TCP or UDP port open?
  6. Is anything blocked by a firewall, security group, or network policy?