Sub topic 9
Special-purpose address ranges
Most of the IPv4 space is ordinary unicast space, handed out to organizations and routed across the internet. Some blocks are set aside for jobs that have nothing to do with reaching a host elsewhere on the internet. This chapter covers those blocks and how to recognize them.
This chapter assumes you can read a dotted-decimal address, understand a CIDR prefix such as /8, and know the class boundaries (A starts at 0, B at 128, C at 192, D at 224, E at 240). The private ranges from RFC 1918 and the shared range 100.64.0.0/10 get their own chapters. They appear here only to show where they fit.
Why some ranges are special
A router decides what to do with a packet from its destination address. For most addresses the answer is "look up a route and forward it." Special-purpose ranges change that answer:
- Some packets must never leave the host.
- Some must never leave the local link.
- Some go to a group of receivers instead of one.
- Some are not valid on the public internet at all.
Standards documents (RFC 6890 collects the registry) reserve these blocks so that every implementation treats them the same way. If you assign one of these addresses to an ordinary host, you break the rule that a device somewhere else depends on.
The ranges
| Range | Name | Purpose |
|---|---|---|
| 0.0.0.0/8 | "This network" | Source address for a host that has no address yet. `0.0.0.0` is the usual value. |
| 127.0.0.0/8 | Loopback | Traffic to the host itself. It never reaches the network. |
| 169.254.0.0/16 | Link-local | Self-assigned addresses when no DHCP server answers. |
| 224.0.0.0/4 | Multicast (old class D) | One sender, many receivers. Covers 224.0.0.0 to 239.255.255.255. |
| 240.0.0.0/4 | Reserved (old class E) | Held back for future use. Not usable on the public internet. |
| 255.255.255.255/32 | Limited broadcast | Every host on the local link. |
Three more blocks are worth knowing by sight. 192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24 are documentation ranges (often called TEST-NET). Examples in books and RFCs use them so that no one's real network is named by accident.
0.0.0.0/8: this network
0.0.0.0 has several meanings that depend on context, and mixing them up is a common source of confusion.
- As a source address: "I do not have an address yet." A host sending a DHCP Discover uses
0.0.0.0as the source and255.255.255.255as the destination. - As a listening address: a server bound to
0.0.0.0accepts connections on every local interface. - As a prefix length of zero:
0.0.0.0/0is the default route, which matches every destination. This is a routing-table entry, not the same thing as the 0.0.0.0/8 block.
127.0.0.0/8: loopback
The whole /8 is loopback, not just 127.0.0.1. The operating system delivers any packet sent to 127.x.y.z back to itself, and the packet never reaches a network card. That is 16,777,216 addresses, although in practice people use only 127.0.0.1 (usually named localhost).
The choice between 127.0.0.1 and 0.0.0.0 matters when you start a server:
- Bound to
127.0.0.1, the service is reachable only from the same machine. - Bound to
0.0.0.0, the service is reachable from any network the machine is attached to. Binding a development database this way by accident is a classic exposure mistake.
A packet with a 127.x source or destination that arrives on a real interface is invalid. Routers and firewalls should drop it.
169.254.0.0/16: link-local
When a host is set to use DHCP and no server responds, many systems pick an address in this range for themselves. Microsoft calls this APIPA. The host chooses an address at random and checks with ARP that no one else is using it.
Link-local addresses work only on the directly attached link. Routers must not forward them. Seeing a 169.254.x.x address on a machine therefore usually means "DHCP failed," so it is a useful diagnostic signal.
224.0.0.0/4: multicast
A multicast address names a group, and any host that has joined the group receives the traffic. The first octet is 224 to 239. Some well-known groups:
224.0.0.1: all hosts on the link.224.0.0.2: all routers on the link.224.0.0.5: OSPF routers.224.0.0.251: multicast DNS (mDNS).
The block 224.0.0.0/24 is for local network control. Routers never forward it beyond the link. A multicast address is only ever a destination. It is never the source of a packet.
240.0.0.0/4 and 255.255.255.255: reserved and limited broadcast
The old class E block was never put to general use. Routers on the public internet do not carry it. Some operating systems accept it as a unicast address, but you cannot rely on that, so avoid it.
The last address in the whole space, 255.255.255.255, is a special case inside the reserved block. It is the limited broadcast. Every host on the local link receives it, and routers do not forward it. Do not confuse it with a directed broadcast such as 192.168.1.255, which is the last address of one specific subnet.
A decision flow
The checks below can be done in any order, since the ranges do not overlap. The one exception is the limited broadcast, which sits inside 240.0.0.0/4 and so must be tested first.
Classifying addresses in Python
The ipaddress module has helper properties such as is_loopback, is_link_local, is_multicast, and is_unspecified. A table-driven function is easier to read and extend, and it shows the ordering rule directly.
import ipaddress
SPECIAL = [
("0.0.0.0/8", "this network"),
("127.0.0.0/8", "loopback"),
("169.254.0.0/16", "link-local"),
("224.0.0.0/4", "multicast"),
("255.255.255.255/32", "limited broadcast"), # must precede 240.0.0.0/4
("240.0.0.0/4", "reserved"),
]
SPECIAL = [(ipaddress.ip_network(cidr), label) for cidr, label in SPECIAL]
def classify(text):
address = ipaddress.ip_address(text)
for network, label in SPECIAL:
if address in network:
return label
return "no special-purpose range"
for sample in [
"0.0.0.0",
"127.45.6.7",
"169.254.10.20",
"224.0.0.251",
"255.255.255.255",
"250.1.1.1",
"8.8.8.8",
]:
print(f"{sample:16} {classify(sample)}")The output is:
0.0.0.0 this network
127.45.6.7 loopback
169.254.10.20 link-local
224.0.0.251 multicast
255.255.255.255 limited broadcast
250.1.1.1 reserved
8.8.8.8 no special-purpose rangeNote that 127.45.6.7 is loopback even though it is not 127.0.0.1.
Common errors
- Treating only 127.0.0.1 as loopback. The whole 127.0.0.0/8 block is loopback. A filter that rejects only
127.0.0.1lets127.1.2.3through. - Testing
255.255.255.255after 240.0.0.0/4. The broadcast address is also in the reserved block, so a check in the wrong order reports it as merely "reserved." - Confusing
0.0.0.0as a bind address with0.0.0.0/0as a route. One means "all interfaces," the other means "all destinations." - Assuming 169.254.x.x is a working configuration. It means the host failed to get an address by DHCP. It can talk to neighbors on the same link and nothing else.
- Using a class E or multicast address for a host. Many routers and operating systems reject these as unicast addresses, and the failures can be hard to trace.
- Using real addresses in documentation. Example addresses in docs, tests, and sample configs should come from the TEST-NET ranges so they never point at someone's live host.
Where these ranges sit in the whole space
Addresses fall into three groups. The special-purpose blocks above are never ordinary public unicast. The private ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) are routable inside an organization but not on the public internet. Everything else is public unicast, assigned by regional registries. The next chapters cover the private ranges in detail and then show how NAT lets hosts that use them reach the internet.
Exercise
A laptop shows the address 169.254.77.12 and cannot reach any website. What most likely happened, and why can it still talk to the printer on the same switch?
Show answer
The laptop did not get a reply from a DHCP server, so it assigned itself a link-local address from 169.254.0.0/16. Link-local addresses work only on the directly attached link, so it can reach neighbors that also have link-local addresses (or can answer on that link), but routers will not forward its traffic, so it cannot reach the internet.
Exercise
A developer starts a web server bound to 0.0.0.0 on port 8080 and another one bound to 127.0.0.1 on port 9090. Which is reachable from other machines on the network, and why?
Show answer
The one on port 8080. Binding to 0.0.0.0 means "all local interfaces," so connections arriving on the network interface are accepted. The one bound to 127.0.0.1 listens only on the loopback interface, and packets to it never leave the host.
Exercise
Why must the limited broadcast address 255.255.255.255 be checked before 240.0.0.0/4 in a classifier, and how does it differ from 192.168.1.255 on a /24 network?
Show answer
255.255.255.255 lies inside 240.0.0.0/4, so checking the larger block first would label it "reserved" instead of "limited broadcast." It reaches every host on the local link and is never forwarded by routers. 192.168.1.255 is a directed broadcast, the last address of one specific subnet, and is tied to that subnet.