Pcornel
Browse topics
Options
Recent
Favorites
Networking · Technical reference

IPv4 Addressing & Subnetting

Direct answer

An IPv4 address is 32 bits; the prefix length (or mask) says how many of them name the network. The rest number the hosts: a /24 has 256 addresses, 254 usable, with the first as the network address and the last as broadcast.

When to use this

Use it to work out whether two hosts are on the same subnet, what a subnet's range is, and how to divide a block.

First 30 seconds

1. Write the address and prefix; find the block size (256 − mask octet).

2. Network address = the multiple of the block size at or below the address; broadcast = next network − 1.

3. Are the host and its gateway in the same range? If not, the mask or address is wrong.

4. Is the address the network or broadcast address itself? Not usable.

5. show ip route connected — do two interfaces overlap?

Operational verification

address and prefix → network address and broadcast → host range → host and gateway in the same subnet → no overlap with another subnet → route to the subnet exists elsewhere

Context & applicabilityCommon mistakes · platform/version boundaries
Common mistakes
Common mistakes
  • "The addresses look similar, so they are in the same subnet." Only the calculation tells: 10.1.1.130/25 and 10.1.1.20/25 are not.
  • "A /24 has 256 hosts." 254: the network and broadcast addresses are not assignable.
  • "The network address always ends in .0 and broadcast in .255." Only for /24 and shorter boundaries on that octet; in 192.168.10.32/27 they are .32 and .63.
  • "The mask only matters on the router." Each host uses its own mask to decide what is local.
  • "A /30 is needed for every point-to-point link." A /31 works on such links and wastes nothing.
  • "Subnet mask and wildcard mask are interchangeable." They are inverses; using one for the other matches the wrong addresses.
Platform / version applicability
Protocol standard + deployed implementation
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformProtocol standard
Scope / prerequisiteUse it to work out whether two hosts are on the same subnet, what a subnet's range is, and how to divide a block.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

3 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Verification & show-command thinking Verify boundary
CommandShows
show ip interface briefAddress and state per interface
show ip interface <interface>Address with prefix length, and whether the interface is up
show ip route connectedThe subnets this device is directly attached to
show ip route <address>Which route — and so which subnet — an address matches
show running-config interface <interface>The configured address and mask

On a host: ipconfig /all (Windows) or ip addr and ip route (Linux) show the address, mask and default gateway — the three values to compare with the plan.

Step 2 Troubleshooting workflow Narrow the fault

1. Read the host's address, mask and gateway. Calculate its subnet. Is the gateway inside it? If not, the host cannot leave its network.

2. An address of 169.254.x.x means DHCP failed; the problem is DHCP, not subnetting.

3. Reaches some hosts on the network and not others → the mask is too long on this host or theirs: each side disagrees about who is local.

4. Reaches its own network and nothing else → wrong or missing default gateway.

5. On the router: show ip route connected — does the interface's subnet match the hosts'? Do two interfaces overlap? IOS refuses overlapping subnets on one device, but two devices can each hold one half of a mistake.

6. Duplicate address → intermittent loss, with the ARP entry alternating between two MAC addresses.

Step 3 Addressing failures: prove local vs routed first Narrow the fault

When two hosts cannot communicate, first calculate whether they believe the destination is local. If both endpoints use inconsistent masks, one host may ARP while the other routes through a gateway. That asymmetry can look like a switching or firewall problem.

Verify IP/prefix/default gateway on both endpoints, calculate the actual networks, then choose ARP/L2 evidence for same-subnet traffic or route/CEF evidence for routed traffic.

Evidence references

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.

observation · 1
Command lookup Jump straight to Cisco syntax
Key points

Usable hosts = 2^(32 − prefix) − 2. The block size in the interesting octet is 256 minus the mask value: /26 is 255.255.255.192, blocks of 64 — .0, .64, .128, .192. Two hosts talk directly only if both see the other inside their own subnet. Private ranges: 10/8, 172.16/12, 192.168/16.

Key checks
  • show ip interface brief — addresses and state per interface.
  • show ip interface <interface> — address with mask.
  • show ip route connected — the subnets the device is directly on.
  • show ip route <address> — which subnet an address falls in.
  • On a host: ipconfig (Windows) or ip addr (Linux) — address, mask, gateway.
ReferenceWhat it is1 section · depth on demand

Concept overview

An IPv4 address is a 32-bit number written as four decimal octets, such as 192.168.10.37. The prefix length — /24, or the mask 255.255.255.0 — says how many of the leading bits identify the network; the remaining bits number the hosts on it. Subnetting is choosing that boundary so each network gets as many addresses as it needs.

ReferenceWhy it matters1 section · depth on demand

Why it matters

Every host decides from its own address and mask whether a destination is on its own network, to be reached directly, or elsewhere, to be sent to the default gateway. A wrong mask therefore produces odd, partial failures: a host that reaches some addresses and not others. Being able to calculate a subnet's range quickly settles such cases — and is the basis for every addressing plan, route and access list.

ReferenceHow it works1 section · depth on demand

How it works

Network and host bits. With a /24, the first 24 bits are the network and the last 8 the host part: 2^8 = 256 addresses. Two of them are reserved — the first is the *network address* (all host bits 0), the last the *broadcast address* (all host bits 1) — leaving 254 for hosts.

The usual prefixes.

PrefixMaskAddressesUsable hostsBlock size
/24255.255.255.02562541 in the third octet
/25255.255.255.128128126128
/26255.255.255.192646264
/27255.255.255.224323032
/28255.255.255.240161416
/29255.255.255.248868
/30255.255.255.252424
/31255.255.255.25422 (point-to-point links)2
/32255.255.255.2551a single host1

Finding a subnet by block size. The block size is 256 minus the mask's value in the octet where the boundary falls. Subnets start at multiples of it.

Example: 192.168.10.37/27. Mask octet 224, block size 32. Subnets start at .0, .32, .64 … so the address is in 192.168.10.32/27: network .32, hosts .33–.62, broadcast .63.

Example in the third octet: 172.16.77.9/20. Mask 255.255.240.0, block size 16 in the third octet. Multiples: 64, 80 … so the subnet is 172.16.64.0/20, running to 172.16.79.255.

Same subnet or not. Two hosts communicate directly only if each finds the other inside its own subnet. 10.1.1.130/25 and 10.1.1.20/25 look alike but are in different subnets (.128/25 and .0/25) and need a router.

Dividing a block (VLSM). Allocate the largest subnets first and work down, each on its own block boundary: from 10.0.0.0/24, a /25 for 100 hosts (.0–.127), a /26 for 50 (.128–.191), a /27 for 20 (.192–.223), and /30s for links from .224.

Summarising is the reverse: 10.1.0.0/24 to 10.1.3.0/24 share their first 22 bits and can be advertised as 10.1.0.0/22.

ReferenceImportant terms & boundaries3 sections · depth on demand

Important terms and limits

TermMeaning
Prefix length (CIDR)Number of network bits: /24
Subnet maskThe same in dotted form: 255.255.255.0
Wildcard maskThe inverse, used in ACLs and OSPF: 0.0.0.255
Network addressFirst address of the subnet; identifies it in routes
Broadcast addressLast address; reaches every host in the subnet
Default gatewayThe router address in the host's own subnet

Reserved ranges.

RangeUse
10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16Private addresses
127.0.0.0/8Loopback
169.254.0.0/16Link-local — self-assigned when DHCP fails
100.64.0.0/10Shared address space for carrier NAT
224.0.0.0/4Multicast

Subnet boundaries and VLSM reasoning

IPv4 subnetting is easier when every problem is reduced to prefix boundary → network → broadcast → usable range → overlap. A prefix length decides how many high-order bits belong to the network; decimal masks are only another representation of that boundary.

For VLSM, allocate the largest requirement first, choose the smallest prefix that satisfies it, align the subnet to its block size, then continue with the next free boundary. The validation step is just as important as the calculation: verify that no requested subnet overlaps another and that every gateway/address belongs to the intended prefix.

In depth

IPv4 addressing, private space and subnetting

Most enterprise IPv4 addressing uses the private ranges from RFC 1918: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. The RFC says routes for private networks must not be propagated, and packets with private addresses must not be forwarded, across links between enterprises. Providers should filter them. Hosts with private addresses can reach every host inside the enterprise. To reach anything outside, they need a mediating gateway, which in practice is NAT or a proxy.

Private and special-purpose blocks

BlockUse
10.0.0.0/8Private (RFC 1918): large enterprises
172.16.0.0/12Private (172.16.0.0–172.31.255.255)
192.168.0.0/16Private: small sites, home networks
100.64.0.0/10Shared address space for carrier-grade NAT (RFC 6598)
169.254.0.0/16Link-local: a host with no DHCP answer
127.0.0.0/8Loopback

Subnetting by block size

PrefixMaskBlock sizeHosts
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/29255.255.255.24886
/30255.255.255.25242
/31255.255.255.25422 (point-to-point, RFC 3021)

Worked example: 172.20.14.77/28

The block size is 16. Multiples of 16 below 77 are 64 and 80, so the network is 172.20.14.64, the broadcast address is 172.20.14.79, and the usable hosts are .65 to .78.

Filtering at the edge (RFC 1918)

DirectionRule
Inbound from the InternetDrop packets with RFC 1918 source addresses
Outbound to the InternetDrop un-NATed RFC 1918 sources (a configuration error)
BGPNever accept or advertise RFC 1918 routes on external sessions
host$ python3 -c "import ipaddress as i; n=i.ip_interface('172.20.14.77/28').network; print(n, n.broadcast_address, list(n.hosts())[0], list(n.hosts())[-1])"
172.20.14.64/28 172.20.14.79 172.20.14.65 172.20.14.78
R1(config)# ip access-list extended INTERNET-IN
R1(config-ext-nacl)# deny ip 10.0.0.0 0.255.255.255 any
R1(config-ext-nacl)# deny ip 172.16.0.0 0.15.255.255 any
R1(config-ext-nacl)# deny ip 192.168.0.0 0.0.255.255 any

A 169.254.x.x address on a host is a symptom, not a configuration. The host found no DHCP server.

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docProtocol standard + deployed implementation RFC 791

Authoritative/upstream documentation reviewed for bounded claims in Network Fundamentals → IPv4 Addressing & Subnetting. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://www.rfc-editor.org/rfc/rfc791.html · confidence 94%
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
subnettingCIDRVLSMsubnet maskhost range
Confirmation

Confirm action

Continue?