Sub topic 5
Diagnosing IP, DHCP, and DNS problems
This chapter assumes you know the six-step troubleshooting methodology, what an IP address, subnet mask, default gateway, and DNS server are, and how to open a Command Prompt. You will use ping, ipconfig, nslookup, and tracert to find out which layer of the configuration is broken, then apply the matching fix.
The working model
A computer needs four settings to use a network and the internet:
- An IP address that is unique on the local network.
- A subnet mask, which tells the computer which addresses are local.
- A default gateway, which is the router address the computer sends non-local traffic to.
- One or more DNS servers, which turn names such as example.com into IP addresses.
Most networks hand out all four with DHCP (Dynamic Host Configuration Protocol). A DHCP server leases an address to a client for a set time. The client asks for a lease when it connects and tries to renew it partway through the lease period.
Each setting can fail on its own, and each failure has a different symptom. That is why you test from the inside out instead of guessing.
Step 1: Read the configuration
Start with the settings the computer is actually using.
ipconfig /allLook at each adapter that shows as connected. Check these fields:
| Field | What to look for |
|---|---|
| IPv4 Address | Fits the local network, for example 192.168.1.x |
| Subnet Mask | Matches the other devices on the network |
| Default Gateway | The router's address, in the same subnet |
| DHCP Server | Present if DHCP is in use |
| DNS Servers | Reachable addresses, normally the router or the ISP |
| Lease Obtained / Expires | Shows when the lease started and when it ends |
A common exam trap is reading the wrong adapter. A laptop may list Ethernet, Wi-Fi, and virtual adapters. Only the adapter carrying the traffic matters.
Step 2: Test in layers with ping
ping sends ICMP echo requests and reports whether replies come back. Run the tests in this order.
ping 127.0.0.1
ping 192.168.1.1
ping 8.8.8.8
ping example.comEach result narrows the fault.
| Test | If it fails | Likely cause |
|---|---|---|
| 127.0.0.1 (loopback) | The local TCP/IP stack is broken | Corrupt network stack or driver, disabled adapter |
| Default gateway | The local network is unreachable | Bad cable, wrong Wi-Fi network, wrong IP or mask, wrong gateway |
| Public IP such as 8.8.8.8 | Traffic does not leave your network | Router has no uplink, ISP outage, bad route |
| Hostname | Names do not resolve | DNS server unreachable or misconfigured |
The pattern that identifies DNS is specific: the public IP address answers, and the hostname does not. If you can reach 8.8.8.8 but not example.com, the connection itself is fine.
Some devices and firewalls block ICMP, so a failed ping is not always proof that a host is down. A successful ping is stronger evidence than a failed one.
DHCP problems and APIPA
When a Windows client cannot reach a DHCP server, it gives itself an address in 169.254.0.0/16. This is APIPA (Automatic Private IP Addressing). The client can talk to other APIPA hosts on the same segment, but it has no gateway, so it cannot reach other networks or the internet.
Seeing a 169.254.x.x address means the client did not get a lease. Common causes:
- The DHCP server or router service is stopped or down.
- The DHCP scope has no free addresses left.
- The cable is unplugged or the Wi-Fi connection is not really established.
- A switch port or VLAN assignment blocks the client from reaching the server.
Work from the client outward. Confirm the link first, because an unplugged cable looks the same as a dead DHCP server from the address alone. Then ask for a new lease.
ipconfig /release
ipconfig /renew
ipconfig /flushdns/release drops the current lease. /renew requests a new one. /flushdns clears the DNS resolver cache. If /renew still fails and the cable is good, move to the server side: check that the DHCP service is running and that the scope has free addresses.
Other address faults
Not every bad address is APIPA. Compare the settings against a working computer on the same network.
- Wrong static address: A manually set address in the wrong subnet cannot reach the gateway. Switch the adapter to obtain an address automatically, or correct the values.
- Wrong subnet mask: The computer decides that local hosts are remote, or the reverse. Pings to some neighbors work and others fail.
- Wrong default gateway: The computer reaches local devices but nothing beyond them. The gateway ping fails, or succeeds only against the wrong device.
- Duplicate IP address: Two devices claim the same address. Windows shows an address conflict message, and connectivity drops intermittently. Find the device with the static address that overlaps the DHCP scope and move it outside the scope, or create a DHCP reservation.
- Wrong network: A laptop joined to a guest Wi-Fi network gets a valid address but cannot reach internal resources.
DNS problems
DNS failures have a recognizable symptom. Websites fail by name, but the same sites load when you type their IP address, and ping 8.8.8.8 works. Use nslookup to test name resolution directly.
nslookup example.com
tracert example.comnslookup shows which DNS server answered and what address it returned. If it reports that the server timed out or cannot find the name, test again against a different resolver.
nslookup example.com 8.8.8.8If the query works against 8.8.8.8 and fails against the configured server, the configured DNS server is the problem. Fix it by correcting the DNS entries in the adapter settings or the DHCP scope options. A stale cache is a separate cause. Run ipconfig /flushdns when a name resolves to an old address, for example after a website moves to a new server.
tracert shows each router hop on the way to the destination. Use it after the basic tests to find where packets stop. A row of Request timed out at hop 1 points at the local gateway. A stop several hops out suggests a fault at the ISP or beyond, which you usually cannot fix yourself. Escalate with the trace output as evidence.
Common errors in diagnosis
- Pinging a name first. If the name fails, you cannot tell whether the cause is DNS or connectivity. Ping an IP address first.
- Skipping the link check. Check the cable, link lights, or Wi-Fi association before blaming DHCP.
- Trusting one failed ping. ICMP may be blocked. Confirm with a second method, such as opening a web page by IP address.
- Changing several things at once. Make one change, then test again. Otherwise you cannot say which change fixed it.
- Forgetting to verify and document. After the fix, confirm that the user can do the original task, then record the cause and the change.
Applying the methodology
The six steps map directly to this work. Identify the problem by asking what changed and what the user sees. Establish a theory, starting with the simplest cause, such as a loose cable. Test the theory with the layered pings. Establish a plan and implement the fix, for example ipconfig /renew. Verify full system functionality. Document the findings, actions, and outcomes.
Exercises
Exercise
A user's computer shows the address 169.254.37.12. The cable is plugged in and the link light is on. What happened, and what is the next step?
Show answer
The computer could not get a lease from a DHCP server and assigned itself an APIPA address. Run ipconfig /release and ipconfig /renew. If that fails, check that the DHCP service on the router or server is running and that the scope has free addresses.
Exercise
A technician can ping 192.168.1.1 and 8.8.8.8, but ping example.com reports that the host cannot be found. Which component is at fault, and which command confirms it?
Show answer
DNS name resolution is failing, because the network connection works for IP addresses. nslookup example.com confirms it by showing whether the configured DNS server returns an answer. Running nslookup example.com 8.8.8.8 tests another resolver for comparison.
Exercise
A computer has the address 192.168.1.50 and can ping other local computers, but it cannot ping 8.8.8.8. The gateway ping fails. Name two likely causes.
Show answer
The default gateway setting may be wrong, or the router may be down or unreachable. A wrong subnet mask is another possible cause. Check the values with ipconfig /all and compare them with a working computer.