Sub topic 5
Diagnosing IP, DHCP, and DNS problems
This chapter assumes you know what an IP address, subnet mask, default gateway, and DNS server are, and that you can open a Windows command prompt. You will use ping, ipconfig, nslookup, and tracert to tell addressing faults from name resolution faults.
The working model
A computer needs four settings to use the internet: an IP address, a subnet mask, a default gateway, and a DNS server. DHCP normally hands out all four as a lease. If any one is wrong, a different symptom appears. Your job is to match the symptom to the failing setting.
| Symptom | Likely cause | First check |
|---|---|---|
| Address starts with 169.254 | No DHCP lease (APIPA) | `ipconfig /all`, DHCP server, cable or Wi-Fi |
| Local devices work, internet does not | Wrong or missing default gateway | Gateway in `ipconfig /all`, then ping it |
| Ping by IP works, ping by name fails | DNS failure | `nslookup` |
| Only some local devices are reachable | Wrong subnet mask or wrong network | Compare address and mask with working PCs |
| "IP address conflict" message | Duplicate address, often a static address inside the DHCP range | Renew the lease or move the static address |
Work from the inside out
Each ping tests one more layer than the last. Stop at the first failure.
ping 127.0.0.1
ping 192.168.1.1
ping 8.8.8.8
ping example.comDiagnosing DHCP and APIPA
Run ipconfig /all and read the output for each adapter. Check the IPv4 address, mask, default gateway, DHCP server, and DNS servers.
An address in 169.254.0.0/16 means the computer asked for a lease, got no answer, and assigned itself an APIPA address. APIPA addresses do not include a gateway, so the computer can talk only to other APIPA devices on the same link. Look for the cause in this order:
- Check the cable, port, or Wi-Fi connection.
- Confirm the router or DHCP server is running and has free addresses in its scope.
- Request a new lease.
ipconfig /release
ipconfig /renew
ipconfig /flushdns/release drops the current lease, /renew requests a new one, and /flushdns clears the cached name lookups.
Diagnosing DNS
If ping to 8.8.8.8 works but ping to example.com fails, the network path is fine and name resolution is the problem.
nslookup example.com
tracert example.comnslookup asks the configured DNS server to resolve the name. A timeout or "server failed" message means the DNS server is wrong, down, or unreachable. Check the DNS entries in ipconfig /all. Try a known public resolver such as 8.8.8.8 to confirm the fault is the server and not the PC. After you correct the setting, run ipconfig /flushdns so old failed answers are not reused.
tracert lists each router hop. Rows of Request timed out from one hop onward show where packets stop. Some routers do not reply to tracert even though they forward traffic, so a single timed-out hop in the middle is not proof of a fault if later hops respond.
Common errors
- Assuming "no internet" means a bad ISP. Test the gateway first.
- Setting a static address inside the DHCP scope, which causes conflicts.
- Typing a gateway outside the PC's own subnet.
- Forgetting to flush the DNS cache after a fix.
- Treating a timed-out ping as proof of failure. Some devices block ping.
Exercise
A laptop shows the address 169.254.37.12. It can ping 127.0.0.1 but nothing else. Name the cause, and give the next two steps.
Show answer
The laptop got no DHCP lease and assigned itself an APIPA address. First check the physical link, meaning the cable, switch port, or Wi-Fi connection, and confirm the DHCP server is running with free addresses. Then run ipconfig /release and ipconfig /renew to request a new lease.
Exercise
A PC can ping 8.8.8.8 but not example.com. Which command do you run next, and what does the failure tell you?
Show answer
Run nslookup example.com. If it times out or fails, the DNS server settings are wrong or the server is unreachable. The network path is working. Correct the DNS server, then run ipconfig /flushdns.