The Subnet Mask and Slash Notation

An IP address consists of two addresses: the network address and the host address. A subnet mask separates the network address from the host address in the IP address.

We use an IP address always with the subnet mask. A subnet mask defines the boundary between the network address and the host address in the IP address. A network address is the group address. We use it to create a group of IP addresses. A group of IP addresses is known as an IP subnet. A host address is an individual address. In an IP subnet, all addresses have the same network address and different host addresses.

The following image shows four IP subnets having six host addresses.

network address and host address

In binary, an IP address is 32 bits long. It divides these bits into four sections. In each, it keeps 8 bits or 1 byte (8 bits = 1 byte). It uses dots to separate them.

We use IP addresses in decimal. From 8 binary bits, the maximum number we can make in decimal is 256. IP addresses start from 0. Hence, the maximum number in decimal will be 255 (256 -1).

ip bits

We use the subnet mask to separate network and host bits in an IP address. For 32 IP bits, we use 32 subnet mask bits. Subnet mask bits and IP address bits have one-to-one relations. The first subnet mask bit relates with the first IP bit, the second subnet mask bit with the second IP bit, and so on til the last bit.

ip bit and subnet relation

A subnet mask bit shows the type of the related IP bit. If its value is 1, the IP bit will be a network bit. If its value is 0, the IP bit will be a host bit.

ip address and subnet mask

There are five IP classes . These are A, B, C, D, and E. Only classes A, B, and C are available for network addressing. We cannot use classes D and E for network addressing. Network services use class D for multicast addressing. Class E is reserved for research.

Class First address (binary notation) Last address (binary notation) First address (decimal notation) Last address (decimal notation)
A 00000000 01111111 0 127
B 10000000 10111111 128 191
C 11000000 11011111 192 223
D 11100000 11101111 224 239
E 11110000 11111111 240 255

Default subnet mask

IP addresses in classes D and E have all network bits. They do not have host bits. Since they do not have host bits and a subnet mask is used to differentiate host bits from network bits, they do not need a subnet mask.

Only IP addresses in classes A, B, and C have host bits and need a subnet mask. These classes have a default subnet mask.

The following table lists default subnet masks.

ClassDefault subnet mask
A255.0.0.0
B255.255.0.0
C255.255.255.0
DNot applicable
ENot applicable

Because of the default subnet masks, the first 8, 16, and 24 bits in classes A, B, and C are always network bits.

Slash notation

Slash notation is a shorter way to write subnet masks. In this notation, instead of writing the full subnet mask, we use only the number of bits having the value 1 after the slash with the IP address.

For example, the default subnet mask of class A is 255.0.0.0. In binary, it is 11111111.00000000.00000000.00000000. It has 8 network bits having the value of 1. In slash notation, we will write this subnet mask as /8.

The default subnet mask of class B has 16 network bits. In slash notation, it will be /16. The default subnet mask of class C has 24 network bits. In slash notation, we will write it as /24.

ClassDefault subnet maskSlash notation
A255.0.0.0/8
B255.255.0.0/16
C255.255.255.0/24

The following table lists some examples of IP addresses and their subnet mask in all three notations.

In Slash notation In binary notation In decimal notation
10.10.10.10/8 00001010.00001010.00001010.00001010
11111111.00000000.00000000.00000000
10.10.10.10
255.0.0.0
172.168.1.1/16 10101100.10101000.00000001.00000001
11111111.11111111.00000000.00000000
172.168.1.1
255.255.0.
192.168.1.1/24 11000000.10101000.00000001.00000001
11111111.11111111.11111111.00000000
192.168.1.1
255.255.255.0
192.168.1.1/28 11000000.10101000.00000001.00000001
11111111.11111111.11111111.11110000
192.168.1.1
255.255.255.240

Bits in the subnet mask

Bits in the subnet mask always follow a pattern. They are written from left to right. Network bits are always written before the host bits. We cannot write a host bit between network bits.

network bits and host bits

Subnetting

Subnetting is a process of breaking an IP subnet into many small subnets. To break an IP subnet, we convert the host bits into network bits. We start the conversion process from the leftmost host bit.

network bits and host bits

When converting bits, we cannot skip any host bit. For example, if we want to break a subnet into two subnets, we will convert the leftmost host bit into a network bit. If we want to break it into four subnets, we will convert the two leftmost host bits into network bits.

Key points:-

  • A subnet mask is a 32 bits binary address.
  • IP addresses use subnet masks to separate network bits and host bits.
  • Subnet mask bits and IP address bits have a one-to-one association.
  • The first subnet mask bit relates to the first IP bit, the second subnet mask bit relates to the second IP bit, and so on til the last bit.
  • If the subnet mask bit's value is 1, the related IP bit belongs to the network address.
  • If the subnet mask bit's value is 0, the related IP bit belongs to the network address.
  • Subnet mask bits are written from left to right.
  • In a subnet, network bits are always written before the host bits.
  • Subnetting is a process of breaking a subnet into many subnets.
  • In subnetting, we convert host bits into network bits.
  • Subnetting always starts from the leftmost host bit and goes to the rightmost bit without skipping any bit.

ComputerNetworkingNotes CCNA Study Guide The Subnet Mask and Slash Notation