Troubleshooting with ping, traceroute and Friends
Use a bottom-up method and the core tools, ipconfig and ip, ping, traceroute, nslookup and dig, and ss or netstat, to find where a network problem lives.
Welcome back!
Step 1 of 13Learn
"The internet is down"
It's Monday morning and Priya, the office's only IT person, hears it from three people at once: "The internet is down." It might be a cable, a Wi-Fi problem, a DHCP failure, DNS, the router, the provider or a single website. Guessing wastes time. Professionals use a method.
The most reliable approach works bottom up through the layers, testing each in turn:
- Physical and link. Is the cable plugged in and the port light on? Is Wi-Fi connected to the right network? Is it one device or everyone?
- IP configuration. Does the device have a valid address, mask, gateway and DNS server? A 169.254.x.x address means DHCP failed.
- Local connectivity. Can you reach the default gateway?
- Remote connectivity. Can you reach an IP address on the internet?
- Name resolution. Can you resolve names to addresses?
- The service. Is the specific port and application responding?
The first step that fails tells you where to dig. Two more habits help a lot: find the scope (one user, one floor or everyone; one site or all sites), because that points to the shared component, and ask what changed recently, such as an update, a new device, or a password or configuration change. Many outages are caused by the most recent change.
Step 2 of 13Diagram
Narrowing down "the internet is down"
Tap a shape with to see more.
- One person or everyone?
One device points to that device; everyone points to shared equipment or the provider.
- Is there a link?
Cable lights, Wi-Fi association.
- Valid IP and gateway?
A 169.254.x.x address means DHCP failed.
- Can it reach the internet by IP?
Ping a public address.
- Do names resolve?
If IP works but names fail, look at DNS.
- Is it just one site or app?
Then the problem is probably at the far end.
Step 3 of 13Learn
Checking configuration and reaching the gateway
See your configuration.
- Windows:
ipconfigshows address, mask and gateway;ipconfig /alladds DNS servers, DHCP details and MAC addresses.ipconfig /releaseandipconfig /renewrequest a fresh DHCP lease, andipconfig /flushdnsclears the DNS cache. - Linux:
ip addr(orip a) shows interfaces and addresses,ip routeshows the default gateway, andresolvectl statusor/etc/resolv.confshows DNS servers. - macOS:
ifconfigandnetworksetup, or the network settings panel.
Test reachability with ping. ping sends ICMP echo requests and reports replies and round-trip times:
$ ping -c 4 192.168.1.1
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=1.8 ms
...
4 packets transmitted, 4 received, 0% packet loss(-c 4 sends four pings on Linux and macOS; Windows sends four by default and uses -n to change the count.)
A standard ping sequence: ping 127.0.0.1 (is the network stack working?), ping your own IP, ping the gateway, ping a well-known internet IP such as a public DNS resolver, then ping a name. Watch for packet loss (some replies missing), which points to a weak Wi-Fi signal, a bad cable or congestion, and for unusually high or jumpy times.
One caution: many servers and firewalls block ping, so "no reply" doesn't always mean "down". Treat a successful ping as strong evidence and a failed one as a clue to check with other tools.
Step 4 of 13Practice · Put in order
Put this bottom-up ping sequence in the order a technician would use it.
Drag the items, or use the arrow buttons, to put them in order.
- ping a domain name such as example.com
- ping the computer's own IP address
- ping a public IP address such as 1.1.1.1
- ping the default gateway
- ping 127.0.0.1 (loopback)
Step 5 of 13Practice · What would you do?
What would you do?
A user can't load any websites. You find: ping 192.168.1.1 (gateway) works, ping 1.1.1.1 works, but ping example.com says "could not find host". Where is the problem?
Step 6 of 13Diagram
The bottom-up ping ladder
Climb from the bottom. The first rung that fails tells you where to look.
Tap a shape with to see more.
- ping example.com
Tests name resolution on top of everything below.
- ping 1.1.1.1
Tests routing beyond your network to the internet.
- ping the default gateway
Tests the local link to the router.
- ping your own IP
Tests that the network adapter is configured.
- ping 127.0.0.1
Tests the computer's own network software.
Step 7 of 13Learn
DNS tools, traceroute and open ports
Test DNS directly. nslookup example.com shows which DNS server answered and the address it returned. dig example.com (Linux and macOS) shows the full answer including TTL, and dig @1.1.1.1 example.com asks a specific server. If a public resolver answers correctly but your configured one doesn't, your DNS server is the problem.
Trace the path. traceroute example.com (Linux and macOS) or tracert example.com (Windows) shows each hop. If the trace stops at your own router, the problem is local or with your provider; if it gets far into the internet and stops near the destination, the problem is likely on the far side. mtr combines ping and traceroute and is great for spotting which hop introduces packet loss.
Check ports and connections.
ss -tulpnon Linux (or the oldernetstat -tulpn) lists the ports that programs are listening on, which answers "is my web server actually listening on 443?"netstat -anoon Windows shows connections with process IDs.Test-NetConnection example.com -Port 443in Windows PowerShell, ornc -zv example.com 443on Linux, tests whether you can open a TCP connection to a specific port, a better test than ping for a service.curl -I https://example.comfetches just the HTTP headers, showing the status code without a browser.
These tools map neatly onto the layers: ping and traceroute for Layer 3, nc and ss for Layer 4, nslookup, dig and curl for the application layer.
Step 8 of 13Practice · Match the pairs
Match each question to the tool that answers it.
Tap an answer, then tap the place where it belongs (or drag it there).
- Is the web server process listening on port 443 on this Linux box?
- Which router along the path is dropping packets?
- What IP address does this name resolve to, and which server answered?
- What are my IP address, gateway and DNS servers on Windows?
- Does the site return a 200 or a 500 status code?
Step 9 of 13Compare
The same tools on Windows and Linux/macOS
| Aspect | Windows | Linux / macOS |
|---|---|---|
| Show addresses | ipconfig /all | ip addr (Linux), ifconfig (macOS) |
| Test reachability | ping | ping |
| Trace the path | tracert | traceroute (or mtr) |
| Query DNS | nslookup | dig or nslookup |
| List connections and ports | netstat -an | ss -tulpn |
Step 10 of 13Note
Step 11 of 13Practice · Sort into groups
Priya has run some tests. Sort each finding by the layer it points to.
Tap an item, then tap its group (or drag it there).
Step 12 of 13Practice · True or false
If ping to a server fails, the server is definitely down.
Step 13 of 13Practice · Choose one
Everyone in the office suddenly loses internet access at the same time, while printing and file sharing inside the office still work. Which component is the most likely culprit?
Lesson complete!