Subnetting Tutorial - Subnetting Explained with Examples

Default IP subnets contain too many IP addresses. Most networks do not need such a large number of IP addresses. If they use default IP subnets, all unused IP addresses will waste. Subnetting solves this problem. It allows us breaks default IP subnets as per network requirement and size.

An IP address contains two addresses: network address and host address . A network address is a group address. All IP addresses in an IP group have the same network address. A host address is a node address. All IP addresses in an IP group have different host addresses. An IP group is known as an IP subnet.

We use an IP address with the subnet mask. A subnet mask separates the network address from the host address.

Both an IP address and subnet mask are 32 bits in length. They arrange bits into four parts. Each part is known as an octet and contains 8 bits. Octets are separated by periods and written in a sequence.

IP address 32 bit

A subnet mask assigns an individual bit for each IP bit. A subnet mask bit can be either on or off. The value zero represents an off bit. The value one represents an on bit. An off bit represents a host bit in the IP address. An on bit represents a network bit in the IP address.

There are two popular notations to write the IP address and subnet mask: Decimal notation and Binary notation.

The following table lists the relationship between subnet mask value and IP bits.

Notation Subnet Mask value IP bit
Decimal 1 to 255 Network
0 Host
Binary 1 Network
0 Host

Examples of IP addresses with the subnet mask in binary format




ip address in binary notation

Examples of IP addresses with the subnet mask in decimal format

IP address with subnet mask decimal notation

Reserve IP classes, network bits, and host bits

Each IP address belongs to a predefined IP class. There are five predefined IP classes; A, B, C, D, and E. From these classes, classes D and E are reserved and cannot be used in Subnetting.

In classes A, B, and C, the first 8, 16, and 24 bits are reserved for the network portion, respectively. These classes also reserve the last two bits for the host portion. We can not use reserve bits for subnetting.

reserved network bits

After excluding reserved network and host bits, the remaining bits are considered subnetting eligible host bits. We can use only subnetting eligible host bits for subnetting.

subnetting eligible bits

Network address and Broadcast address

Every IP network needs two specific addresses network address and broadcast address. A network address represents the network itself, while a broadcast address represents all the hosts in the network. We can not assign these addresses to any individual host in the network.

Since each IP subnet requires these two addresses, this requirement increases if we break the IP subnet into IP subnets.

network address broadcast address

Network and broadcast addresses are also known as Network ID and broadcast ID, respectively.

Valid host addresses

All addresses between the network and broadcast addresses are known as valid host addresses. Any device that uses the IP protocol to transfer data needs a valid host address. We can assign only valid host addresses to end devices such as computers, laptops, tablets, smartphones, IP phones, servers, printers, terminals, IP cameras, and networking devices such as switches, routers, firewalls, and proxy servers.

Block Size

Block size is the sum of network addresses, valid host addresses, and broadcast addresses. For example, if we have six valid host addresses, the block size will be 8 (1 network address + 6 valid host addresses + 1 broadcast address).

Power of 2

An IP address is a combination of 32 binary bits. Understanding how many combinations the number of bits provides or to get the number of combinations how many bits we need is the essential step of subnetting.

In an IP address:-

  • A combination of all 32 binary bits shows the complete IP address.
  • A combination of only network bits indicates the number of IP subnets it provides in decimal.
  • A combination of only host bits indicates the number of host addresses it provides in decimal.

To know how many combinations the number of bits provides or to get the number of combinations and how many bits are required, we use the power of 2.

For example, to break a single IP subnet into 4 IP subnets, we need 2 (22 = 4) subnetting eligible host bits. This way, if we have 3 subnetting eligible host bits, we can make 8 (23 = 8) additional networks.

The following table lists the power of 2 to 32.

2X Value 2X Value 2X Value 2X Value
1 2 9 512 17 131072 25 33554432
2 4 10 1024 18 262144 26 67108864
3 8 11 2048 19 524288 27 134217728
4 16 12 4096 20 1048576 28 268435456
5 32 13 8192 21 2097152 29 536870912
6 64 14 16384 22 4194304 30 1073741824
7 128 15 32768 23 8388608 31 2147483648
8 256 16 65536 24 16777216 32 4294967296

In 2X the X is the number of bits.

Subnetting Direction

Subnetting always flows in a single direction (left to right) without skipping any bit. This simple rule gives us the exact location of subnetting bits in an address space.

Let’s take an example.

A class C network is subnetted in 4 subnets. Find the number of host bits used in subnetting and their location in the address space.

subnetting direction

To create 4 subnets we need 2 (22 = 4) subnetting eligible host bits. Since in class C network space, subnetting eligible bits start from 25 and subnetting always goes from left to right without skipping any bit, the bits used in this network are 25 and 26.

ComputerNetworkingNotes CCNA Study Guide Subnetting Tutorial - Subnetting Explained with Examples