Sub topic 6
IPv4 addressing, private ranges, and APIPA
This chapter assumes you know what a router does, can open a command prompt, and understand that each device on a network needs an identifier. It covers how IPv4 addresses are structured, which ranges are private, what APIPA means, and how to read the address settings on a PC. DHCP, DNS, and NAT get their own chapters. They appear here only where they explain an address.
The structure of an IPv4 address
An IPv4 address is a 32-bit number. It is written as four decimal values called octets, separated by dots, for example 192.168.1.25. Each octet is 8 bits, so it ranges from 0 to 255.
Every address has two parts:
- The network portion identifies the network the device belongs to.
- The host portion identifies the device on that network.
The subnet mask shows where the split falls. A mask of 255.255.255.0 means the first three octets are the network portion and the last octet is the host portion. Devices with the same network portion can talk directly. Traffic to any other network goes through the default gateway, which is normally the SOHO router's LAN address.
Masks are also written in CIDR notation (Classless Inter-Domain Routing). /24 means 24 bits are the network portion, which equals 255.255.255.0.
| CIDR | Subnet mask | Typical use |
|---|---|---|
| /8 | 255.0.0.0 | Very large private networks |
| /16 | 255.255.0.0 | Large networks, APIPA range |
| /24 | 255.255.255.0 | Home and small office LANs |
In a /24 network such as 192.168.1.0/24, two addresses are reserved. The first (192.168.1.0) names the network itself. The last (192.168.1.255) is the broadcast address, which reaches every device on that network. That leaves 254 usable host addresses.
Public and private addresses
A public address is routable on the internet and is assigned to you by your ISP. A private address is for use inside a LAN only. Internet routers drop traffic addressed to private ranges, so many homes and offices can reuse the same private addresses without conflict.
RFC 1918 defines three private ranges:
| Class | Range | Default mask |
|---|---|---|
| A | 10.0.0.0 to 10.255.255.255 | 255.0.0.0 (/8) |
| B | 172.16.0.0 to 172.31.255.255 | 255.240.0.0 (/12) |
| C | 192.168.0.0 to 192.168.255.255 | 255.255.0.0 (/16) |
Most SOHO routers default to 192.168.0.x or 192.168.1.x. Some use 10.0.0.x.
A common exam trap is the Class B range. It stops at 172.31.x.x. An address such as 172.32.0.5 is public, and 172.15.0.5 is public too.
Two other special ranges are worth memorizing:
127.0.0.0/8is loopback.127.0.0.1always refers to the local machine, whatever the network does.169.254.0.0/16is the link-local range used by APIPA.
APIPA
APIPA stands for Automatic Private IP Addressing. When a Windows PC is set to obtain an address automatically and no DHCP server answers, the PC assigns itself an address from 169.254.0.0/16 with mask 255.255.0.0.
APIPA lets devices on the same physical network reach each other without a server. It does not provide a default gateway or DNS. A PC with an APIPA address can usually talk to other APIPA devices on the same segment, but it cannot reach the internet.
For technicians, a 169.254.x.x address is a symptom. It tells you the DHCP request failed. Likely causes:
- The DHCP server or router is down or its DHCP service is disabled.
- The cable is faulty or the Wi-Fi association is poor, so the request never arrived.
- The DHCP pool is full, so no address is left to hand out.
- The device is on the wrong VLAN or port.
Fix the cause upstream. Typing a different 169.254 address does nothing useful.
Static and dynamic assignment
Dynamic assignment through DHCP is the default. The router hands out addresses from a pool and the lease is renewed periodically. Static assignment means you type the address, mask, gateway, and DNS yourself on the device. Static addresses suit printers, servers, and other devices that others need to find at a fixed location.
Static assignment has two risks. If you pick an address inside the DHCP pool, the router may give the same address to another device. That creates an address conflict, and Windows shows a warning about a duplicate IP. Also, a typo in the mask or gateway gives a device that can reach some hosts but not others. A DHCP reservation, covered in the DHCP chapter, avoids both problems.
Reading the settings with ipconfig
The ipconfig /all command shows the full configuration of each adapter.
ipconfig /allCheck these fields in the output:
- IPv4 Address: the address the adapter is using.
- Subnet Mask: confirms the network and host split.
- Default Gateway: the router address. A blank value means no route off the local network.
- DHCP Enabled and DHCP Server: show whether the address came from a server and which one.
- DNS Servers: the resolvers the PC uses.
- Autoconfiguration IPv4 Address: Windows labels an APIPA address this way.
A healthy home PC might show 192.168.1.25, mask 255.255.255.0, gateway 192.168.1.1. A PC with a 169.254.x.x address and no gateway needs DHCP troubleshooting.
Two more mistakes to watch for. An address outside the gateway's subnet, such as 192.168.2.25 with gateway 192.168.1.1 and mask 255.255.255.0, cannot reach its gateway. A mask that does not match the rest of the network can break only some connections, which makes the fault look intermittent.
Worked example
A user reports that the office printer is reachable but the internet is not. You run ipconfig /all and see:
- IPv4 Address:
169.254.37.8 - Subnet Mask:
255.255.0.0 - Default Gateway: blank
The 169.254 address means DHCP failed. The blank gateway explains the missing internet. You check the cable and the router, then renew the lease:
ipconfig /release
ipconfig /renewIf the new output shows 192.168.1.x with a gateway, the problem is solved. If the address stays at 169.254.x.x, the fault is on the DHCP server side or in the physical link.
Quick reference
- Private:
10.0.0.0/8,172.16.0.0/12,192.168.0.0/16. - APIPA:
169.254.0.0/16, no gateway, local only. - Loopback:
127.0.0.1, tests the local TCP/IP stack. - A /24 network has 254 usable hosts.
- The gateway must sit in the same subnet as the host.
Exercise
A laptop shows the IPv4 address 169.254.88.12, mask 255.255.0.0, and no default gateway. It is connected to the office Wi-Fi. What does this tell you, and what are two things you would check first?
Show answer
The laptop did not receive an address from a DHCP server and assigned itself an APIPA address, so it has no gateway and no internet access. Check that the router's DHCP service is enabled and its address pool is not full, and check the Wi-Fi connection (signal and association). Then run ipconfig /release and ipconfig /renew to request a new lease.
Exercise
Which of these addresses are private, and which are public: 10.20.30.40, 172.31.255.1, 172.32.0.1, 192.168.300.1, 192.169.1.1?
Show answer
Private: 10.20.30.40 and 172.31.255.1. Public: 172.32.0.1 (outside 172.16.0.0 to 172.31.255.255) and 192.169.1.1 (outside 192.168.0.0/16). 192.168.300.1 is not a valid address at all, because an octet cannot exceed 255.