Network
Troubleshooting
Essential Linux and Windows networking commands for diagnosing connectivity issues, inspecting interfaces, tracing routes, and checking DNS — all in one reference.
What is Network Troubleshooting?
Network troubleshooting is the systematic process of diagnosing and resolving network connectivity, performance, and configuration issues using CLI tools built into Linux and Windows operating systems.
Real-world use: When a server can't reach the internet, when DNS stops resolving, when a service becomes unreachable, or when you need to verify firewall rules — these commands are your first line of investigation.
Who uses it: Network engineers, sysadmins, SOC analysts, penetration testers, and developers. These commands are also essential for certifications like CompTIA Network+, CCNA, and CEH.
1. Systematic Troubleshooting Flow
ip link show / ipconfigip addr / ipconfig /allping 192.168.1.1ping 8.8.8.8nslookup google.com / dig google.comtraceroute / tracertss -tlnp / netstat -ano2. Linux Networking Commands
# Modern: ip command (preferred) ip addr show # all interfaces + IPs ip addr show eth0 # specific interface ip link show # link state (UP/DOWN) ip route show # routing table ip route get 8.8.8.8 # route to specific host ip neigh show # ARP table # Legacy: ifconfig (still common) ifconfig # all active interfaces ifconfig eth0 # specific interface ifconfig eth0 up # bring interface up ifconfig eth0 192.168.1.10/24 # set IP address
ping 8.8.8.8 # continuous ping (Ctrl+C to stop) ping -c 4 google.com # send exactly 4 packets ping -i 0.2 192.168.1.1 # 0.2s interval (faster) ping -s 1400 192.168.1.1 # set packet size (MTU testing) ping6 ::1 # ping IPv6 loopback
traceroute google.com # default (UDP) traceroute -I google.com # use ICMP (like Windows tracert) traceroute -T -p 80 google.com # TCP SYN on port 80 traceroute -n google.com # no DNS resolution (faster) mtr google.com # live continuous trace (better than traceroute)
dig is more detailed and scriptable; nslookup is cross-platform.# dig — preferred DNS tool dig google.com # A record (IPv4) dig google.com AAAA # AAAA record (IPv6) dig google.com MX # mail exchange records dig google.com TXT # TXT records (SPF, DKIM etc) dig @8.8.8.8 google.com # query specific DNS server dig +short google.com # just the IP answer dig -x 8.8.8.8 # reverse DNS lookup dig axfr @ns1.target.com target.com # zone transfer (pentest) # nslookup nslookup google.com nslookup -type=MX google.com
# ss — modern replacement for netstat ss -tlnp # TCP listening with process names ss -ulnp # UDP listening ss -tnp # established TCP connections ss -s # summary statistics ss -tlnp | grep :22 # find what's on port 22 # netstat (older but still widely used) netstat -tlnp # TCP listening netstat -rn # routing table netstat -an | grep ESTABLISHED # established connections
# arp — view/manage ARP cache arp -a # show ARP table arp -n # numeric, no hostname resolution # curl / wget — HTTP testing curl -I https://google.com # fetch headers only curl -v https://google.com # verbose (shows TLS handshake) curl --resolve example.com:443:1.2.3.4 https://example.com # tcpdump — packet capture tcpdump -i eth0 # capture on interface tcpdump -i eth0 port 80 # filter by port tcpdump -i any -w capture.pcap # write to file (open in Wireshark) # host — simple DNS lookup host google.com host 8.8.8.8 # reverse lookup
3. Windows Networking Commands
ipconfig # basic IP info ipconfig /all # full config incl MAC, DNS, DHCP ipconfig /release # release DHCP lease ipconfig /renew # request new DHCP lease ipconfig /flushdns # clear DNS resolver cache ipconfig /displaydns # show cached DNS entries ipconfig /registerdns # re-register DNS names
ping 8.8.8.8 # sends 4 packets by default ping -t 8.8.8.8 # continuous until Ctrl+C ping -n 10 google.com # send 10 packets ping -l 1400 192.168.1.1 # set packet size ping -4 google.com # force IPv4 ping -6 google.com # force IPv6
tracert google.com # trace route to destination tracert -d google.com # no DNS resolution (faster) tracert -h 15 google.com # max 15 hops pathping google.com # combines ping + tracert with stats
nslookup google.com # default DNS query nslookup -type=MX google.com # mail records nslookup -type=TXT google.com # TXT records nslookup 8.8.8.8 # reverse lookup nslookup google.com 8.8.8.8 # use specific DNS server
netstat -ano # all connections with PID netstat -ano | findstr :443 # filter by port 443 netstat -ano | findstr LISTEN # listening ports only netstat -rn # routing table netstat -s # protocol statistics # Find process by PID (from netstat output) tasklist | findstr "1234" # find process with PID 1234
# arp — ARP table arp -a # display ARP cache arp -d * # clear ARP cache # route — routing table route print # display routing table route add 10.0.0.0 mask 255.0.0.0 192.168.1.1 # netsh — advanced config netsh interface ip show config # interface config netsh wlan show profiles # saved Wi-Fi profiles netsh advfirewall show allprofiles # Test-NetConnection (PowerShell) Test-NetConnection google.com -Port 443 Test-NetConnection -ComputerName 192.168.1.1 -TraceRoute
4. Linux vs Windows Quick Reference
| Task | Linux | Windows |
|---|---|---|
| Show IP address | ip addr / ifconfig | ipconfig /all |
| Ping test | ping -c 4 host | ping host |
| Trace route | traceroute host | tracert host |
| DNS lookup | dig / nslookup | nslookup |
| Show routing table | ip route show | route print |
| ARP table | arp -a / ip neigh | arp -a |
| Open ports | ss -tlnp | netstat -ano |
| Flush DNS cache | systemd-resolve --flush-caches | ipconfig /flushdns |
| Capture packets | tcpdump | Wireshark / netsh trace |
| HTTP test | curl -I | Invoke-WebRequest (PS) |
| Renew DHCP | dhclient -r / dhclient | ipconfig /release + /renew |