Sub topic 17
Troubleshooting with Command-Line Tools
This chapter assumes you know IPv4 addressing, DHCP, APIPA and DNS from earlier chapters. It shows how to use Windows command-line tools to find where a connection breaks.
The Working Model
Troubleshoot from the inside out. Check the computer's own configuration first, then the local network, then the internet, then name resolution. The first test that fails shows where the fault is.
Step 1: Read the Configuration
ipconfig /allThis shows the IP address, subnet mask, default gateway, DHCP server and DNS servers for each adapter. Look for these signs:
- An address starting with 169.254 is APIPA. The client could not reach a DHCP server.
- A missing default gateway means the client cannot leave its subnet.
- A wrong DNS server means names will not resolve.
Step 2: Test in Order
ping 127.0.0.1
ping 192.168.1.1
ping example.com- The loopback address tests the local TCP/IP stack. It does not test the network card or the cable.
- The gateway test checks the local link. Use your own gateway address.
- The name test checks DNS and internet reachability together.
If the IP address works but the name fails, the fault is DNS.
Step 3: Fix the Address
If the client has a bad or APIPA address, ask DHCP for a new lease:
ipconfig /release
ipconfig /renew
ipconfig /flushdns/release drops the current lease. /renew requests a new one. /flushdns clears the local resolver cache, which helps when a site moved to a new address.
Step 4: Find Where It Breaks
nslookup example.com
tracert example.com
netstat -an| Command | What it shows | Use it when |
|---|---|---|
| nslookup | The IP address DNS returns for a name | Names fail but IP pings work |
| tracert | Each router hop and its delay | A destination is slow or unreachable |
| netstat -an | Active connections and listening ports | You need to see which ports are open |
In tracert output, a row of Request timed out that continues to the end shows where traffic stops. A single timeout in the middle is often a router that ignores the probe, not a real fault.
Common Errors
- Testing the internet first. A failure there does not tell you which layer is at fault.
- Pinging the wrong gateway. Take the address from
ipconfig /all, not from memory. - Blaming DNS when the gateway is down. Always test the IP address before the name.
Exercise
A user can ping 8.8.8.8 successfully but cannot ping example.com. What is the most likely problem, and which command helps confirm it?
Show answer
The fault is DNS name resolution, because the internet path works. Run nslookup example.com to see whether the DNS server returns an address. Check the DNS servers in ipconfig /all, and try ipconfig /flushdns.
Exercise
ipconfig /all shows an address of 169.254.17.40. What does it mean, and what two commands are a common first step?
Show answer
It is an APIPA address. The client could not get a lease from a DHCP server. Run ipconfig /release and then ipconfig /renew. If that fails, check the cable or Wi-Fi link and the DHCP server.