Use it when reading or writing addresses in slash notation, or comparing route specificity.
Prefix · Addressing
The prefix (prefix length) is the number of leading bits that identify the network, written /n; a /26 has 26 network bits and 64 addresses.
1. The prefix length defines the network part of an address.
2. Must match on all devices in a subnet.
3. Mismatched masks break ARP and routing.
4. Longer prefix = smaller network.
5. Check both ends of links.
address + prefix → network ID → connected route
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Common mistakes Narrow the fault
- Mixing up prefix length and wildcard mask in ACLs and OSPF network statements.
- Assuming /24 because the address looks like an old class C.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Prefix length and mask describe the same boundary
- Network and directed-broadcast addresses are not ordinary host addresses
- Hosts per traditional subnet are 2^(host bits)-2, with point-to-point exceptions
- VLSM allocates largest requirements first and must avoid overlap.
show ip interface brief— interface addressesshow ip interface <interface>— Internet address with /len
ReferenceWhat it is1 section · depth on demand
Reading prefix lengths
The prefix length counts the network bits. Each extra bit halves the subnet:
| Prefix | Host bits | Addresses |
|---|---|---|
| /16 | 16 | 65 536 |
| /20 | 12 | 4 096 |
| /24 | 8 | 256 |
| /28 | 4 | 16 |
| /32 | 0 | 1 (host route) |
Routers use the longest matching prefix: a packet to 10.1.1.5 matches 10.1.1.0/24 before 10.0.0.0/8 and before 0.0.0.0/0.
ReferenceWhy it matters1 section · depth on demand
How it works
The prefix length (/24) is the number of leading 1-bits in the subnet mask. Every extra bit halves the block: /24 = 256 addresses, /25 = 128, /26 = 64, /27 = 32, /28 = 16. Routers compare prefix lengths for longest-match routing, so the same address can match several routes of different lengths.
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
One block, written the way each IOS command expects
Block: 10.1.4.0/22 (10.1.4.0 – 10.1.7.255)
| Context | Syntax |
|---|---|
| Interface address | ip address 10.1.4.1 255.255.252.0 |
| Static route | ip route 10.1.4.0 255.255.252.0 192.0.2.1 |
| Prefix list | ip prefix-list SITE permit 10.1.4.0/22 |
| Prefix list incl. subnets | ip prefix-list SITE permit 10.1.4.0/22 le 24 |
| ACL (wildcard) | permit ip 10.1.4.0 0.0.3.255 any |
| OSPF network statement | network 10.1.4.0 0.0.3.255 area 0 |
| BGP | network 10.1.4.0 mask 255.255.252.0 |
| IPv6 equivalent idea | ipv6 route 2001:db8:4::/48 2001:db8::1 |
Wildcard = 255.255.255.255 − mask, octet by octet (255 − 252 = 3).
Prefix-list length matching
| Entry | Matches |
|---|---|
10.1.4.0/22 | Exactly /22 |
10.1.4.0/22 le 24 | /22, /23 and /24 inside the block |
10.1.4.0/22 ge 24 le 24 | Only the /24s inside the block |
0.0.0.0/0 le 32 | Everything |
0.0.0.0/0 | Only the default route |
Prefix length and route preference
A longer prefix is more specific and wins the forwarding lookup regardless of protocol (RFC 4632 aggregation relies on this). Every additional bit halves the block, so /22 → /23 splits it into two halves.
Checks
show ip route 10.1.4.0 255.255.252.0 longer-prefixeslists the components under the /22.show ip prefix-list SITEshows hit counts per entry — useful to confirm thele/gelogic.- IOS rejects a static route whose address has host bits set for the given mask (
%Inconsistent address and mask), which catches many prefix mistakes.
Quick reference
| Prefix | Mask | Wildcard | Hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 0.255.255.255 | 16 777 214 |
| /16 | 255.255.0.0 | 0.0.255.255 | 65 534 |
| /22 | 255.255.252.0 | 0.0.3.255 | 1 022 |
| /23 | 255.255.254.0 | 0.0.1.255 | 510 |
| /24 | 255.255.255.0 | 0.0.0.255 | 254 |
| /30 | 255.255.255.252 | 0.0.0.3 | 2 |
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in IP Fundamentals → IPv4 → Addressing → Prefix. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.rfc-editor.org/rfc/rfc791.html · confidence 94%