Field note / addressing bench

Find the range.
Then choose the route.

An IPv4 prefix fixes the leading bits of an address. A routing table selects the most specific matching prefix before comparing the metrics used in this simplified example.

IPv4 prefix calculator

Example: 10.20.20.80/24 belongs to 10.20.20.0/24, covering 256 addresses from 10.20.20.0 to 10.20.20.255.

Do not subtract two from every range

On an ordinary /24 broadcast subnet, reserving the network and directed-broadcast addresses leaves 254 host addresses. A /31 has two total addresses; on a point-to-point link both can identify endpoints. A /32 specifies exactly one address and commonly appears as a host route. A /0 matches all 2³² IPv4 addresses; that mathematical range is not a claim that all of them are assignable hosts.

Sources: RFC 4632 section 3.1, and RFC 3021 section 2.1 for point-to-point /31 behavior.

A high metric can still win

DestinationMetric
0.0.0.0/01
10.20.0.0/1610
10.20.20.0/2450
10.20.20.80 matches all three routes. The /24 wins because it is the longest matching prefix.

Try 10.20.21.80 and then 192.0.2.10. The first selects /16; the second falls back to /0. Metrics here break equal-prefix ties, then stable route IDs break equal-metric ties. Real routing platforms also distinguish route sources and policies; this table does not simulate those decisions or equal-cost multipath.

Background: RFC 1812 section 5.2.4. The public-address example 192.0.2.10 is within the RFC 5737 documentation range. The tool performs no network requests.

Try these ideas in the branch exercise