Week 6 · Lesson 4

IPv4 Addressing (3): Masks, Prefixes & Assignment

This is where the pieces click together. Given any host address and its mask, you will be able to state the network address, the broadcast address, the range of usable hosts, and how that host finds its way off its own network.

CCNA 200-301 Domain 1.6 IPv4 Addressing Verified 2026-10-11
Part 1

Mask and prefix are the same thing

A subnet mask is a 32-bit number with a run of 1s followed by a run of 0s. The 1s cover the network portion; the 0s cover the host portion. The prefix length is just the count of those leading 1s. So there are two notations for the same idea:

PrefixMask (dotted-decimal)Binary mask
/8255.0.0.011111111.00000000.00000000.00000000
/16255.255.0.011111111.11111111.00000000.00000000
/24255.255.255.011111111.11111111.11111111.00000000
/25255.255.255.12811111111.11111111.11111111.10000000
/26255.255.255.19211111111.11111111.11111111.11000000

When the mask sits exactly on octet boundaries (/8, /16, /24), it is octet-aligned and matches a classful default. Prefixes like /25 and /26 split an octet and belong to subnetting — they are the bridge to Week 7.

Prefix to mask · choose a prefix length

Part 2

Analysing a host address

Given a host address and its mask, three values follow directly. The mask tells you which bits are network and which are host; then you simply set the host bits to all-0 or all-1:

  1. Network address — copy the host address, then set every host bit to 0. (In practice: bitwise-AND the address with the mask.)
  2. Broadcast address — copy the host address, then set every host bit to 1.
  3. Usable range — all addresses between them: the first usable is network + 1, and the last usable is broadcast − 1.
Host: 192.168.1.77    Mask: /24 (255.255.255.0) 192 . 168 . 1 — network . 77 — host Network bits (24) Host bits (8) Network = 192.168.1.0  ·  Broadcast = 192.168.1.255 Usable: 192.168.1.1 – 192.168.1.254  ·  254 addresses

Three worked examples

Host addressNetworkBroadcastFirst usableLast usableUsable
192.168.1.77/24192.168.1.0192.168.1.255192.168.1.1192.168.1.254254
10.0.0.5/810.0.0.010.255.255.25510.0.0.110.255.255.25416,777,214
172.16.0.200/16172.16.0.0172.16.255.255172.16.0.1172.16.255.25465,534

Read the /8 case carefully: the host bits run across the last three octets, so the broadcast is 10.255.255.255 and the usable range spans from 10.0.0.1 to 10.255.255.254. Likewise the /16 broadcast is 172.16.255.255 — only the last two octets vary, because the host portion is 16 bits wide.

Exam tip. When you are asked for “the number of usable hosts”, find h from the prefix and apply 2h − 2. When you are asked to list the range, the first usable address is always the network address + 1 and the last usable is the broadcast − 1.
Part 3

The 2h − 2 formula box

Formula — usable hosts. Usable hosts = 2h − 2, where h = 32 − prefix length. Subtract 1 for the network address (all host bits 0) and 1 for the broadcast address (all host bits 1).

The larger the prefix, the fewer host bits remain, and the smaller the network. For a /24, h = 8, so usable = 28 − 2 = 256 − 2 = 254. That is the classic Class C figure, and it is worth walking through once more as a concrete check:

/24 network: 192.168.1.0/24
Total addresses: 2^8 = 256
Network address: 192.168.1.0    (host bits all 0)
Broadcast address: 192.168.1.255 (host bits all 1)
First usable: 192.168.1.1
Last usable:  192.168.1.254
Usable hosts: 256 - 2 = 254
The formula box · choose a prefix

      

Part 4

How addresses are assigned

A host can receive its IP configuration in one of two ways:

MethodHow it worksBest for
Static (manual)An administrator types the IP, mask, and gateway on the device.Routers, servers, printers, switches — devices needing a fixed address
Dynamic (DHCP)A DHCP server leases an address automatically for a period.PCs, phones, laptops — large numbers of end devices

DHCP (Dynamic Host Configuration Protocol) hands out not just the IP address but also the subnet mask, the default gateway, and DNS server addresses, so a client can join the network with no manual configuration. The trade-off is that a leased address can change; static assignment avoids that but does not scale. Network infrastructure — routers, servers, and the gateway interfaces themselves — are normally configured statically.

! Manually assign an address to a router interface
R1(config)# interface gigabitEthernet 0/0
R1(config-if)# ip address 192.168.1.1 255.255.255.0
R1(config-if)# no shutdown

! Configure a DHCP pool to lease addresses to clients
R1(config)# ip dhcp pool LAN
R1(dhcp-config)# network 192.168.1.0 255.255.255.0
R1(dhcp-config)# default-router 192.168.1.1
Static or dynamic? · pick a device

Part 5

The default gateway

A host can reach any address in its own network directly through Layer 2. But when the destination is on a different network, the host cannot deliver the frame itself — it needs a router. The default gateway is the IP address of the router interface on the host’s own subnet, and it is the “way out” of the local network.

The host’s reasoning is simple: compare the destination with its own network/mask. If the destination is local, send directly (ARP for the destination MAC). If the destination is remote, send the frame to the gateway’s MAC address, but keep the packet’s destination IP set to the final host. The router forwards it onward. A host with a wrong or missing default gateway can talk to its neighbours but cannot reach the Internet or any other subnet — a very common troubleshooting symptom.

Gateway is almost always the first usable address. By convention the router interface on a subnet is given the first usable address, such as 192.168.1.1 on 192.168.1.0/24. That is why the gateway and the first usable host address so often coincide.
Part 6

Octet alignment and the bridge to Week 7

An octet-aligned mask is one whose 1s finish exactly on an octet boundary, such as /8, /16, or /24. These masks are easy to read because each octet is either all-1 (a full network byte) or all-0 (a full host byte). Classful defaults are always octet-aligned.

Masks such as /25, /26, or /27 are not octet-aligned: the network boundary falls inside an octet, so one octet is part network and part host. Recognising alignment tells you at a glance whether a network is classful or a subnet — and that is exactly where Week 7 picks up.

Is this mask octet-aligned? · pick a prefix

Bridge to Week 7: subnetting

You now have everything subnetting builds on: the address structure, the mask/prefix, the 2h − 2 rule, and the network/broadcast boundaries. Subnetting is simply borrowing bits from the host portion to create smaller networks — turning one /24 into, say, four /26s. That move is what lets us size networks precisely and escapes the waste of fixed classful sizes described in Lesson 3. Week 7 develops the technique in full; for now, make sure you can analyse a host address and apply the formula without hesitation.

Key terms

TermMeaning
Subnet maskA 32-bit value with a run of 1s (network bits) then 0s (host bits).
Prefix lengthThe number of leading 1s in the mask, written /n.
Network addressThe address with all host bits 0; it names the network.
Broadcast addressThe address with all host bits 1; reaches every host in the network.
Usable hosts2h − 2, where h is the number of host bits.
Default gatewayThe router interface on the local subnet that a host uses to reach other networks.
DHCPDynamic Host Configuration Protocol; assigns IP, mask, gateway, and DNS automatically.
Octet alignmentWhen a mask's network bits end exactly on an octet boundary (/8, /16, /24).
Part 7 · Your turn

Review

Check what you have learned with these review questions.

Review · 6 questions

Sources

Sources & references

  1. Postel, J. RFC 791: Internet Protocol (1981), Section 2.3 (Addressing) and Section 3.2. rfc-editor.org/rfc/rfc791.
  2. Braden, R. RFC 1122: Requirements for Internet Hosts — Communication Layers (1989), Section 3.3 (address/mask handling). rfc-editor.org/rfc/rfc1122.
  3. Droms, R. RFC 2131: Dynamic Host Configuration Protocol (1997). rfc-editor.org/rfc/rfc2131.
  4. Rekhter, Y. et al. RFC 1918: Address Allocation for Private Internets (1996). rfc-editor.org/rfc/rfc1918.
  5. Cisco. CCNA (200-301) Exam Topics, IP Connectivity / IPv4 addressing and configuration. cisco.com.

Target exams: CCNA 200-301 v1.1 · CyberOps Associate 200-201. Last content verification: 2026-10-11.