Sub topic 2
Network basics you need before troubleshooting
This chapter assumes you can open a Windows command prompt and open the network adapter settings. It also assumes you know what a router, a switch, and an access point do. The goal is a working model of four settings: IP address, subnet mask, default gateway, and DNS server. Most network faults on the A+ Core 1 exam come down to one of these four being wrong, missing, or unreachable.
The four settings every host needs
A host needs four values to talk beyond its own cable or Wi-Fi network.
| Setting | What it does | Typical failure symptom |
|---|---|---|
| IP address | Identifies the host on the network | Duplicate address conflict, or a 169.254.x.x address |
| Subnet mask | Tells the host which addresses are local | Can reach some local hosts but not others |
| Default gateway | The router the host sends non-local traffic to | Local network works, internet does not |
| DNS server | Turns names into IP addresses | Pinging an IP works, pinging a name fails |
An IPv4 address is four numbers from 0 to 255, such as 192.168.1.25. The subnet mask, such as 255.255.255.0, splits the address into a network part and a host part. With that mask, 192.168.1.25 and 192.168.1.40 are on the same network. 192.168.2.40 is not.
The host applies one rule to every outgoing packet:
- If the destination is in the same subnet, send it directly on the local network.
- If the destination is in a different subnet, send it to the default gateway.
The default gateway is the router interface on your own subnet. It must therefore be an address inside your subnet. A gateway of 192.168.2.1 on a host at 192.168.1.25/24 can never work, because the host cannot reach it directly.
You can test the same-subnet rule with a short Python script. It uses only the standard library.
import ipaddress
host = ipaddress.ip_interface("192.168.1.25/255.255.255.0")
gateway = ipaddress.ip_address("192.168.2.1")
destination = ipaddress.ip_address("192.168.1.40")
print("Gateway on local subnet:", gateway in host.network)
print("Destination is local:", destination in host.network)The script prints False for the gateway and True for the destination. That result describes a misconfigured gateway that leaves the host unable to leave its subnet.
Public, private, and special addresses
The exam expects you to recognize address ranges at a glance.
| Range | Meaning |
|---|---|
| 10.0.0.0/8 | Private, not routed on the internet |
| 172.16.0.0/12 (172.16.0.0 to 172.31.255.255) | Private |
| 192.168.0.0/16 | Private, common on home and small office networks |
| 127.0.0.0/8 (usually 127.0.0.1) | Loopback, the host talking to itself |
| 169.254.0.0/16 | APIPA, a self-assigned address used when DHCP fails |
Private addresses reach the internet through NAT (Network Address Translation) on the router. NAT rewrites the private source address to the router's public address. This is why many homes can share one public IP.
A 169.254.x.x address is a diagnostic clue, not a working configuration. It means the host asked for an address, got no answer, and gave itself one. Hosts with APIPA addresses can talk only to other APIPA hosts on the same link. They have no gateway and usually no DNS.
DHCP: how addresses are normally assigned
DHCP (Dynamic Host Configuration Protocol) hands out IP settings automatically. A DHCP server, usually built into the router, keeps a scope. A scope is a pool of addresses plus the mask, gateway, and DNS values to give with them. A client receives a lease, which is a temporary loan of an address for a set time. The client tries to renew the lease about halfway through its duration.
The exchange has four steps, often remembered as DORA.
The Discover is a broadcast because the client has no address yet and does not know where the server is. This has a practical consequence. A broadcast does not cross a router, so a client on a different subnet from the server needs a DHCP relay agent on the router. DHCP uses UDP ports 67 (server) and 68 (client).
Common DHCP faults
- Server unreachable. The server is down, the cable is bad, or the client is on the wrong VLAN. The client falls back to APIPA.
- Scope exhausted. Every address in the pool is leased. New clients get nothing, while existing clients work fine. That pattern points to scope exhaustion, often on a guest network with a long lease time.
- Rogue DHCP server. A second device, often a consumer router plugged in by mistake, hands out wrong gateway or DNS values. Clients get an address but the wrong settings. Some clients work and some do not, depending on which server answered first.
- Static address collision. Someone assigns a fixed address that is also inside the DHCP scope. The result is an address conflict warning. The fix is to exclude the static address from the scope or use a DHCP reservation. A reservation ties an address to one device's MAC address.
A static configuration is manual and is normal for servers, printers, and routers. It is a common source of errors on client PCs, because a mistyped mask or gateway will not correct itself.
DNS: names to addresses
People use names like example.com, but packets need IP addresses. DNS (Domain Name System) translates one to the other. The client sends a query to its configured DNS server on UDP port 53. If that server does not know the answer, it asks other DNS servers and returns the result. The client caches the answer for a while, so a stale entry can make a changed website appear unreachable until the cache is cleared.
Know these record types:
| Record | Maps |
|---|---|
| A | A name to an IPv4 address |
| AAAA | A name to an IPv6 address |
| CNAME | An alias name to another name |
| MX | A domain to its mail server |
Before a query goes to a DNS server, Windows checks its local cache and the hosts file. The hosts file is a plain text file at C:\Windows\System32\drivers\etc\hosts. An entry there overrides DNS. A stale or malicious entry in that file is a classic cause of one site failing while all others work.
DNS faults look different from connectivity faults
The key distinction on the exam is this: if a host reaches an IP address but not the matching name, the network path works and DNS is the problem. If it reaches nothing, DNS is not the first suspect.
| Observation | Most likely cause |
|---|---|
| Ping to 8.8.8.8 works, ping to example.com fails | DNS server wrong or unreachable |
| Ping to the gateway fails | Local link, cable, or gateway address problem |
| Ping to local hosts works, internet fails | Missing or wrong default gateway, or ISP outage |
| Address starts with 169.254 | DHCP failure |
| One website fails, others load | Stale DNS cache or hosts file entry |
Reading the configuration
You will check these four values with ipconfig /all. The commands below are covered in detail in the next chapter. Here they serve only to show where each setting appears.
rem Show every adapter's address, mask, gateway, DHCP server, and DNS servers
ipconfig /allLook at four things in the output for the adapter in use:
- IPv4 Address and Subnet Mask. Does the address belong to the expected network? Is it 169.254.x.x?
- Default Gateway. Is it present, and is it inside the same subnet as the address?
- DHCP Enabled and DHCP Server. "Yes" with a server address means the settings came from a lease. "No" means someone typed them in.
- DNS Servers. Are they the router, your company's DNS servers, or a public resolver?
The layering of failure also tells you where to look. Work from the bottom up:
- A physical link or Wi-Fi association is present.
- The host has a valid address and mask.
- The gateway is reachable.
- Names resolve.
If step 2 fails, steps 3 and 4 cannot succeed, so do not test them yet.
Static versus dynamic: when to change which
Fix a problem at the level where it occurs. If a client has a wrong static address, you can switch the adapter to obtain settings automatically and let DHCP supply good ones. If the DHCP server hands out bad values, fixing every client is wrong. Fix the server or remove the rogue device. Changing one client hides the problem for one user while everyone else still gets bad settings.
Exercise
A technician finds that a PC has the address 192.168.1.50, subnet mask 255.255.255.0, default gateway 192.168.0.1, and DNS server 8.8.8.8. The PC can open shared folders on other 192.168.1.x computers but cannot reach any website. What is the most likely cause, and what is the fix?
Show answer
The default gateway 192.168.0.1 is outside the PC's subnet (192.168.1.0/24), so the PC cannot send non-local traffic to it. Local traffic works because it never uses the gateway. DNS is not the cause, since no traffic leaves the subnet. Correct the gateway to the router's address on the 192.168.1.x network (for example 192.168.1.1), or set the adapter to obtain settings automatically from DHCP.
Exercise
Several new laptops on a guest Wi-Fi network show addresses beginning with 169.254, while laptops that connected earlier still work. Name two likely causes.
Show answer
The DHCP scope is exhausted, because the pool of addresses is full of unexpired leases. Or the DHCP server is unreachable from that network, because it is down or the relay is not working. The earlier laptops still work because they already hold valid leases.