A prefix length states how many leading bits of an IP address form its network portion. Slash notation writes this as /X; the remaining bits form the host portion. For example, 192.168.100.100/24 has 24 network bits and 8 host bits, so devices on the same LAN share the network portion while retaining unique host portions. section 7.3.1
Use the prefix length to determine the network boundary and practical address capacity:
- Convert the prefix length to a netmask: /24 is 255.255.255.0, with 24 mask bits set to 1 and 8 host bits set to 0. section 7.3.1 section 7.3.2
- Calculate host capacity with 2^host-bits − 2 for ordinary IPv4 networks; a /24 provides 254 assignable host addresses. section 7.3.3
- Recognize network and broadcast addresses: the network address has all host bits set to 0, and the broadcast address has them set to 1. section 7.3.3
- Use prefix lengths when subnetting by borrowing host bits; each added bit doubles the number of subnets and reduces available host bits. section 11.2.1
Splitting a /24 network
Borrowing one host bit from 192.168.1.0/24 creates two /25 subnets: 192.168.1.0/25 and 192.168.1.128/25. Borrowing two bits creates four /26 subnets, including 192.168.1.64/26, whose network address is .64, broadcast address is .127, usable range is .65–.126, and maximum host count is 62. section 11.2.1
Using a prefix to choose a route
PC1 at 192.168.1.11/24 recognizes 192.168.3.11 as outside its local network, so it sends the packet to its default gateway at 192.168.1.1. The prefix length lets the host distinguish local delivery from routed delivery. section 10.1.1
Figure 7.7 An IPv4 address written in both dotted decimal and binary. The 32-bit address is split into four octets consisting of 8 bits each. The address is divided into two parts: the network portion and the host portion. The prefix length indicates the size of the network portion in bits, and the remainder is the host portion.
Use the bit-level diagram to see how a 32-bit IPv4 address divides into octets, network bits, and host bits. section 7.3.1
Prefix lengths also appear in router configuration and verification. Cisco IOS accepts the equivalent dotted-decimal netmask with ip address, while show ip interface brief and show ip interface display configured addresses and prefix lengths. IPv6 uses the same slash notation; /64 divides its 128-bit address into 64 network bits and 64 host bits. section 7.3.2 section 20.3.2
