IPv4 Addressing: Private and Public Ranges, Masks, Gateways, APIPA, and Static Versus Dynamic
Unit 3: Network Configuration. Lesson 10 of 41 in APlus Academy Core 1.
Most network troubleshooting on Core 1 comes down to reading an IP configuration and spotting what is wrong. Learn to read one like a technician.
The address and the mask
An IPv4 address is 32 bits written as four decimal octets from 0 to 255: 192.168.1.20. The subnet mask says which part is the network and which part is the host. With mask 255.255.255.0 (written /24), the first three octets are the network and the last is the host: 192.168.1.20 is host 20 on network 192.168.1.0. 255.255.0.0 is /16 and 255.0.0.0 is /8. Two devices whose network portions match are on the same subnet and talk directly through the switch; if they differ, traffic goes through the router.
The default gateway
The gateway is the router's address on the local network, such as 192.168.1.1. It must be inside the same subnet as the host. A device with the wrong gateway can reach its neighbors but nothing beyond them; a device with no gateway is the same.
Private and public addresses
Three ranges are reserved for private networks and never routed on the internet:
- 10.0.0.0 to 10.255.255.255 (10.0.0.0/8), large organizations.
- 172.16.0.0 to 172.31.255.255 (172.16.0.0/12), the one people forget; 172.32.x.x is public.
- 192.168.0.0 to 192.168.255.255 (192.168.0.0/16), home and small office routers.
Everything else is public and routable. A router translates private addresses to its single public address with NAT so a whole office can share one internet address.
Two special addresses
- APIPA, 169.254.x.x: the address a client gives itself when it asks DHCP and nobody answers. It can talk to other APIPA devices on the same segment and nothing else. Seeing 169.254 means "the DHCP server did not reach this device": check the cable, the link light, the VLAN, or the DHCP server.
- Loopback, 127.0.0.1: always the local machine. Pinging it tests the TCP/IP software, not the network card or the cable.
Static versus dynamic
Dynamic addresses come from DHCP and suit workstations, phones, and anything that moves. Static addresses are typed in and belong on things other devices must find at a fixed address: servers, printers, access points, the router itself. The middle path is a DHCP reservation: the server always gives the same address to a given MAC, so the printer keeps its address without anyone touching the printer.
Reading a configuration
A working client shows an address in the expected range, the right mask, a gateway in the same subnet, and one or two DNS servers. Common faults: an APIPA address (no DHCP), a duplicate address warning (two statics collide), a gateway outside the subnet (typo), and DNS pointing at a dead server (addresses work, names do not).
IPv4 Addressing: Private and Public Ranges, Masks, Gateways, APIPA, and Static Versus Dynamic, explained slowly
The address as a street address
An IPv4 address is a street address with the street name and the house number squeezed into one line of four numbers. The subnet mask is a ruler that says how many of the numbers are the street and how many are the house. 192.168.1.20 with 255.255.255.0 means street 192.168.1, house 20. Houses on the same street hand things to each other directly; anything for another street goes to the post office on the corner, the default gateway.
Reading the mask
mask prefix network portion hosts per subnet 255.0.0.0 /8 first octet 16,777,214 255.255.0.0 /16 first two octets 65,534 255.255.255.0 /24 first three octets 254 255.255.255.128 /25 three octets + 1 bit 126 255.255.255.192 /26 three octets + 2 bits 62
Core 1 keeps to the easy masks. The test is: do the network portions match? 10.1.5.20/16 and 10.1.200.7/16 share 10.1, so they are on the same subnet. 10.1.5.20/24 and 10.1.200.7/24 differ in the third octet, so they need a router between them.
The gateway rule
The default gateway must be in the host's own subnet, because the host must be able to reach it directly. A host 192.168.1.20/24 with gateway 192.168.2.1 can talk to its neighbors and nothing else; the gateway is unreachable. This exact mistake, a typo in the third octet, is a standard exam item: "can ping local devices, cannot reach the internet, what is wrong with the configuration?"
Private, public, and NAT
range prefix used by 10.0.0.0 to 10.255.255.255 10.0.0.0/8 enterprises (lots of room) 172.16.0.0 to 172.31.255.255 172.16.0.0/12 mid-size networks; the one people forget 192.168.0.0 to 192.168.255.255 192.168.0.0/16 homes and small offices
Private addresses are free to reuse and are never routed across the internet; a router translates them to its one public address with NAT, tracking each conversation by port so the replies get back to the right inside host. Everything not in those three ranges (and not 127 or 169.254) is public. Watch 172.32.0.1 and 192.169.0.1: both look private and both are public.
The two addresses that diagnose themselves
address meaning what to do 169.254.x.x APIPA: asked DHCP, got no answer check link light, cable, switch port VLAN, DHCP server 127.0.0.1 loopback: this machine's own stack ping it to test TCP/IP is installed and working
An APIPA address is not a random failure; it is a specific message that the DHCP Discover went unanswered. Two APIPA devices on the same switch can still see each other, which is why "two new laptops can share files but neither reaches the internet" points to a dead DHCP server rather than a dead switch.
Static, dynamic, and the reservation compromise
method who sets it good for risk static typed by a person servers, printers, APs, the router typos, duplicates, forgotten changes dynamic (DHCP) the DHCP server workstations, phones, laptops address may change; nothing to find it by reservation DHCP server by MAC printers, NAS, cameras none of the above; one entry to maintain
A reservation is the professional answer to "the printer's address keeps changing." Set it on the DHCP server and the printer keeps its address forever without touching the printer.
Worked example: read this configuration
IPv4 address 192.168.10.57 subnet mask 255.255.255.0 default gateway 192.168.1.1 DNS server 192.168.10.5
The host is on 192.168.10.0/24; the gateway is on 192.168.1.0/24. They do not match, so the gateway is unreachable and the internet is unreachable. Local devices and the DNS server (same subnet) still work. Fix the gateway to 192.168.10.1 (or whatever the router's local address is).
How the exam asks it
- "A workstation has 169.254.34.12. What does this indicate?" It could not reach a DHCP server.
- "Which address range is private?" 172.16.0.0 to 172.31.255.255 (pick the one in the three ranges).
- "Which address tests the local TCP/IP stack?" 127.0.0.1.
- "A printer's IP changes and users lose it. Best fix?" A DHCP reservation (or a static address).
- "Two PCs on the same switch: 192.168.1.10/24 and 192.168.2.10/24. Why can they not communicate?" Different subnets; no router between them.
What to memorize
- Mask splits network from host; /24 = 255.255.255.0; same network portion = same subnet.
- Gateway inside the subnet. Private ranges 10/8, 172.16/12, 192.168/16; NAT shares one public address.
- 169.254 = APIPA = no DHCP. 127.0.0.1 = loopback.
- Static for servers, printers, network gear; dynamic for clients; reservation by MAC.