Linux · Windows · Networking · CLI

Network
Troubleshooting

Essential Linux and Windows networking commands for diagnosing connectivity issues, inspecting interfaces, tracing routes, and checking DNS — all in one reference.

Platforms: Linux & Windows
Level: Beginner → Advanced
Commands: 30+
Topics: 6 sections
GeeksForGeeks 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

1
Check physical/link: Is the cable plugged in? Is Wi-Fi connected? ip link show / ipconfig
2
Check IP address: Do you have a valid IP? ip addr / ipconfig /all
3
Test local gateway: Can you reach your router? ping 192.168.1.1
4
Test internet connectivity: Can you reach a known IP? ping 8.8.8.8
5
Test DNS resolution: Can you resolve domain names? nslookup google.com / dig google.com
6
Trace the route: Where does the packet stop? traceroute / tracert
7
Check open ports/services: Is the service listening? ss -tlnp / netstat -ano

2. Linux Networking Commands

ip / ifconfig — Interface Information
View and configure network interfaces, IP addresses, and link states.
# 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 — Connectivity Test
Tests reachability and round-trip time to a host using ICMP echo requests.
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 — Path Tracing
Maps the route packets take from your machine to a destination, showing each hop's latency.
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 / nslookup — DNS Lookup
Queries DNS records. 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 / netstat — Connections & Ports
View active network connections, listening ports, and socket states.
# 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
Additional Linux Tools
# 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 — Interface Information
Display and manage Windows TCP/IP network configuration.
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 — Connectivity Test
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 — Path Tracing
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 — DNS Queries
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 — Connections & Ports
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
Additional Windows Tools
# 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

TaskLinuxWindows
Show IP addressip addr / ifconfigipconfig /all
Ping testping -c 4 hostping host
Trace routetraceroute hosttracert host
DNS lookupdig / nslookupnslookup
Show routing tableip route showroute print
ARP tablearp -a / ip neigharp -a
Open portsss -tlnpnetstat -ano
Flush DNS cachesystemd-resolve --flush-cachesipconfig /flushdns
Capture packetstcpdumpWireshark / netsh trace
HTTP testcurl -IInvoke-WebRequest (PS)
Renew DHCPdhclient -r / dhclientipconfig /release + /renew

📚 Further Reading