Sub topic 1
Addresses, gateways, and DNS: what you are testing
Prerequisites
This chapter assumes you:
- know roughly what an IP address is
- can open a command prompt or terminal
- know that devices reach each other through routers
Nothing else is required. Later chapters use the tools. This one defines the four settings those tools check.
The four settings every host needs
For a computer to reach a remote service, four values must be correct. Each later test in this tutorial checks one or more of them.
| Setting | What it does | Typical example |
|---|---|---|
| IP address | Identifies your interface on the network | 192.168.1.25 |
| Subnet mask | Defines which addresses are on your local network | 255.255.255.0 |
| Default gateway | The router that receives traffic for any address outside your subnet | 192.168.1.1 |
| DNS server | Translates names such as example.com into IP addresses | 192.168.1.1 or 8.8.8.8 |
How the subnet mask decides where traffic goes
Before sending a packet, your computer compares the destination address with its own address, using the subnet mask. With address 192.168.1.25 and mask 255.255.255.0, every address that starts with 192.168.1 is local. Your computer sends those packets directly to the destination device.
Every other address is remote. Your computer sends those packets to the default gateway, and the gateway forwards them toward the destination. This is why a wrong mask or gateway causes a specific symptom: local devices respond, but nothing beyond the router does.
Addresses versus names
IP addresses are what routers use. Names are for people. Before your computer can contact example.com, it asks a DNS server for the matching IP address. DNS is a separate service from IP routing, so each can fail independently:
- If routing is broken, you cannot reach any address, with or without a name.
- If only DNS is broken, you can reach 8.8.8.8 but not example.com.
Chapter 6 uses this difference to separate name problems from connectivity problems.
Seeing your own values
On Windows, ipconfig /all prints all four settings. A trimmed example of its output:
Ethernet adapter Ethernet:
IPv4 Address. . . . . . . . . . . : 192.168.1.25
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
DNS Servers . . . . . . . . . . . : 192.168.1.1
8.8.8.8On Linux, ip addr show and ip route show give the address and gateway. Later chapters cover these commands in detail.
Common errors this model explains
- Address starting with 169.254.x.x. The host asked for an address by DHCP and received no answer, so it assigned itself a link-local address. It cannot reach other networks.
- Missing default gateway. Local devices work, but every remote destination fails.
- Wrong subnet mask. The host may treat remote devices as local, or the reverse, and send packets to the wrong place.
- Unreachable or wrong DNS server. Addresses work, but names fail.
Where ping and traceroute fit
Ping checks whether a particular address answers. Traceroute lists the routers between you and a destination. Ipconfig shows the settings that both tools depend on. Reading your configuration first tells you which address to test next, and which results to expect.
Exercise
A host has address 192.168.1.25, mask 255.255.255.0, and gateway 192.168.1.1. It can reach 192.168.1.40, but not 8.8.8.8. Which of the four settings would you check first, and why?
Show answer
Check the default gateway. 192.168.1.40 is on the local subnet, so it needs no gateway. 8.8.8.8 is remote, so the packet must go to the gateway. A missing or wrong gateway matches this symptom. DNS is not involved because the test used an IP address and not a name.