1.6 Configure and verify IPv4 addresses and divide a network into subnets

CCNA 200-301 v1.1 · 1.0 Network Fundamentals

Subnetting splits one IPv4 network into smaller ones by moving the boundary between the network and host parts of the address. For the CCNA you must do it fast and without a calculator: find the network, broadcast and usable range of any address, choose a mask for a number of hosts or subnets, and configure and verify addresses on IOS.

What you must know

The block-size method

A prefix such as /27 says how many bits are network bits. 27 bits fill three octets (24) and 3 bits of the fourth, so the mask is 255.255.255.224. The interesting octet is the one where the mask is neither 255 nor 0. Its block size is 256 minus the mask value there: 256 − 224 = 32. Subnets start at multiples of the block size: .0, .32, .64, .96 and so on.

PrefixMaskBlock (4th octet)Usable hosts
/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)
  1. 192.168.10.77/27: the block is 32, and 77 falls between 64 and 96.
  2. Network: 192.168.10.64. Broadcast: one less than the next block, 192.168.10.95.
  3. Usable hosts: 192.168.10.65 to 192.168.10.94, which is 2⁵ − 2 = 30.

Choosing a mask

For hosts, find the smallest h with 2ʰ − 2 ≥ hosts needed; the prefix is 32 − h. 50 hosts need h = 6 (62 usable), so /26. For subnets, find the smallest s with 2ˢ ≥ subnets needed and add s to the original prefix. Eight subnets from 10.1.0.0/16 need s = 3, so /19, with a block of 32 in the third octet.

VLSM gives each subnet the size it needs. Sort the needs from largest to smallest, place each on the next free block boundary, and use /30 or /31 for router-to-router links. The drawing below uses 192.168.10.0/24 for two LANs of different sizes and one point-to-point link.

Configure and verify

interface GigabitEthernet0/1
 ip address 192.168.10.1 255.255.255.128
 no shutdown
!
R1# show ip interface brief
Interface              IP-Address      OK? Method Status                Protocol
GigabitEthernet0/1     192.168.10.1    YES manual up                    up

IOS refuses an address that is the network or broadcast address of its own subnet (Bad mask), and an address that overlaps a subnet already on another interface (overlaps with).

Commands

ip address 192.168.10.1 255.255.255.128Sets the address and mask of an interface.
show ip interface briefEvery interface with its address, method and up/down state.
show ip interface Gi0/1The address with its prefix length, plus helper address, ACLs and more.
show running-config interface Gi0/1The configured address and mask.

Exam traps

Check yourself

What are the network and broadcast of 172.16.45.200/21?
The block is 8 in the third octet; 45 is in 40–47. Network 172.16.40.0, broadcast 172.16.47.255.
Which prefix gives at least 500 hosts with the least waste?
/23: 2⁹ − 2 = 510 hosts.
How many /28 subnets fit in a /24, and how many hosts does each hold?
16 subnets of 14 usable hosts.
Is 10.0.0.64 a valid host in 10.0.0.0/26?
No. /26 blocks are 64; 10.0.0.64 is the network address of the second subnet.

Labs

Try it live: IPv4 subnets, IPv6 and client settings on Windows, macOS and Linux

More topics in 1.0 Network Fundamentals