Reference

Core

Subnetting

Subnetting divides a network into smaller segments by borrowing host bits for additional network bits. Fast, accurate subnetting is a core CCNA skill tested heavily on the exam.

What you need to know

  • Number of subnets = 2^n where n is bits borrowed; number of usable hosts = 2^h - 2 where h is remaining host bits.
  • Block size (increment) = 256 - value of the interesting octet in the mask, e.g. /26 gives block size 64.
  • Common masks: /24=255.255.255.0, /25=.128, /26=.192, /27=.224, /28=.240, /29=.248, /30=.252.
  • A /30 subnet yields 2 usable hosts, ideal for point-to-point WAN links.
  • A /31 subnet (RFC 3021) yields 2 usable addresses with no network/broadcast, for point-to-point links only.
  • To find the subnet of an address, round down to the nearest multiple of the block size in the relevant octet.
  • Broadcast address is one less than the next subnet boundary.

Configuration commands

CommandModePurpose
ip address 192.168.1.65 255.255.255.192config-ifConfigure an address inside a /26 subnet.
ip address 172.16.0.1 255.255.255.252config-ifConfigure a /30 point-to-point link address.
ip address 10.0.0.1 255.255.255.254config-ifConfigure a /31 point-to-point link address.
show ip route connectedexecDisplay connected subnets learned from configured interfaces.
ip subnet-zeroconfigAllow use of the zero subnet (enabled by default on modern IOS).
no ip subnet-zeroconfigDisallow use of the zero subnet (legacy behavior).

Verify it

  • show ip interface brief
  • show ip route
  • show interfaces | include Internet address
  • ping <address>

Common mistakes

  • Miscounting borrowed bits when calculating the number of subnets or hosts.
  • Forgetting to subtract 2 for network and broadcast addresses in usable host counts.
  • Placing two device addresses in different subnets on the same physical link.
  • Using a /30 or /31 mask on a multi-access LAN segment that needs more hosts.
  • Mixing up the block size increment with the mask value itself.

Practise Subnetting in a real CLI

Generated labs, graded against the simulated network state.

Start a free lab