Sub topic 1
Addresses, gateways, and DNS: what you are testing
This chapter defines the pieces of a host's network configuration that ping, traceroute, and ipconfig inspect. Later chapters use these pieces to decide which one failed.
Prerequisites
This chapter assumes you already know the following:
- What an IP address is, at the level of "a number that identifies a device on a network."
- How to open a command prompt (Windows) or a terminal (Linux or macOS).
- That devices on different networks communicate through routers.
You do not need to know how to run the tools yet. The chapters that follow introduce them one at a time.
Why configuration comes first
Every connectivity test checks one of four settings on your computer, or one device that those settings point to. When a test fails, the failing setting tells you where to look. If you cannot name the four settings, a failed ping tells you only that something is wrong.
The four settings are:
- The IP address of the interface.
- The subnet mask.
- The default gateway.
- The DNS server.
An interface is a network connection point on your computer, such as an Ethernet port or a Wi-Fi adapter. A computer with both Wi-Fi and Ethernet has two interfaces, and each has its own settings.
The IP address
An IPv4 address is a 32-bit number, written as four decimal values separated by dots, for example 192.168.1.25. Each value is one byte and ranges from 0 to 255. The address identifies the interface, not the computer. It also has two parts: a network part, which names the network, and a host part, which names the device on that network.
Some address ranges are reserved for private networks and are not routed on the public internet:
| Range | Typical use |
|---|---|
| `10.0.0.0` to `10.255.255.255` | Large organizations |
| `172.16.0.0` to `172.31.255.255` | Medium networks |
| `192.168.0.0` to `192.168.255.255` | Home and small office |
Two other ranges matter when you troubleshoot:
127.0.0.0/8is the loopback range. Traffic sent to127.0.0.1never leaves your computer. It tests the local network software only.169.254.0.0/16is the link-local range. Windows assigns an address from it (called APIPA, Automatic Private IP Addressing) when the interface is set to use DHCP and no DHCP server answers. If you see169.254.x.x, the computer did not get a real address.
DHCP (Dynamic Host Configuration Protocol) is the service that hands out addresses automatically. It usually supplies all four settings at once, together with a lease, which is a time limit after which the computer must renew its address.
The subnet mask
The subnet mask tells the computer which part of an address is the network part. For 255.255.255.0, the first three bytes are the network part and the last byte is the host part. The same mask is often written as a prefix length, /24, which counts the 1 bits in the mask.
The mask lets the computer decide, for each destination, whether the destination is local or remote:
- If the destination is in the same network, the computer sends the packet directly to it.
- If the destination is in a different network, the computer sends the packet to the default gateway.
Here is a worked example. Your address is 192.168.1.25 with mask 255.255.255.0. The network is 192.168.1.0/24, so addresses 192.168.1.1 to 192.168.1.254 are local.
| Destination | Local? | Where the packet goes |
|---|---|---|
| `192.168.1.40` | Yes | Directly to that device |
| `192.168.2.40` | No | To the default gateway |
| `8.8.8.8` | No | To the default gateway |
A wrong mask causes odd failures. If the mask is 255.255.255.128 instead of 255.255.255.0, the computer treats 192.168.1.200 as remote and sends it to the gateway, even though it is on the same segment. Some destinations then work and others do not, which is confusing until you check the mask.
The default gateway
The default gateway is the router that your computer uses for every destination outside its own network. At home it is usually the same box that provides Wi-Fi. Its address is on your local network, such as 192.168.1.1, and it must be inside your subnet. If the gateway address is outside the subnet the mask defines, the computer cannot reach it, and nothing remote works.
The gateway is a single point of dependency. Your computer can talk to other devices on the local network with no gateway at all. But without a working gateway, it cannot reach anything beyond that network. This asymmetry is a useful diagnostic: if local devices answer and remote ones do not, suspect the gateway or the path beyond it.
The DNS server
DNS (Domain Name System) translates names such as example.com into IP addresses. Packets are addressed by IP, so before your computer can contact a name, it asks a DNS server for the matching address. The DNS server address is a fourth setting, and it is often the gateway itself (the home router forwards the questions upstream) or a public resolver.
Name resolution and connectivity are separate functions:
- If the DNS server is wrong or unreachable, names fail but IP addresses still work.
- If the gateway is wrong or down, both fail, because the DNS server is usually remote too.
Your computer also keeps a local DNS cache, which stores recent answers. A stale cache entry can send you to an old address after a site has moved. Chapter material later in this tutorial shows how to clear it.
How a packet leaves your computer
The settings combine in a fixed sequence each time you contact a name. The diagram shows it.
Notice that DNS is consulted first, and the local-or-remote decision happens afterward using the address DNS returned. This is why a DNS failure looks different from a routing failure.
Mapping settings to symptoms
The table below links each setting to the symptom you see when it is wrong. You will use it throughout the later chapters.
| Setting | If it is wrong or missing | Typical symptom |
|---|---|---|
| IP address | No valid identity on the network | `169.254.x.x` address, or no connectivity at all |
| Subnet mask | Wrong local/remote decision | Some local devices unreachable, others fine |
| Default gateway | No path beyond the local network | Local devices respond, internet does not |
| DNS server | Names do not resolve | Pinging by IP works, pinging by name fails |
Two edge cases deserve attention:
- Duplicate addresses. If two devices share one IP address, both may work intermittently. The symptom is flapping connectivity, not a clean failure.
- Multiple interfaces. With Wi-Fi and Ethernet both active, the computer picks an interface using routing metrics. The gateway you expect may not be the one in use. Always check each adapter's settings.
IPv6 follows the same ideas with longer addresses (128 bits) and a prefix length instead of a dotted mask. This tutorial concentrates on IPv4, but the tools work with both, and a computer often has both kinds of address at once.
Where each tool fits
Each tool in this tutorial examines a different part of the picture:
| Tool | What it examines |
|---|---|
| ipconfig | The four settings on your own computer |
| ping | Whether a specific address answers, and how fast |
| traceroute (tracert) | The routers between you and a destination |
The next chapter explains ICMP, the protocol that ping and traceroute use. After that, you will read the four settings with ipconfig and begin testing.
Exercise
A computer has the address 192.168.1.25, mask 255.255.255.0, gateway 192.168.1.1, and a working DNS server. It can ping 192.168.1.40 but not 8.8.8.8. Which of the four settings is the most likely cause, and why is DNS not the cause?
Show answer
The default gateway is the most likely cause. The destination 192.168.1.40 is local, so the computer reaches it directly without the gateway. The destination 8.8.8.8 is remote, so the packet must go through the gateway. DNS is not involved because both tests use IP addresses, which need no name lookup.
Exercise
A computer has the address 192.168.10.130 and mask 255.255.255.128. Is 192.168.10.20 on the same local network? What does the computer do with a packet for it?
Show answer
No. The mask /25 splits the range into 192.168.10.0 to 192.168.10.127 and 192.168.10.128 to 192.168.10.255. The computer is in the second block and 192.168.10.20 is in the first, so the destination is remote. The computer sends the packet to the default gateway.