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. An IP address is always written and used with the subnet mask. This tutorial explains the fundamentals of a 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. It is used 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 with 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. From 8 binary bits, the maximum number you can make in decimal is 256. IP addresses start from 0. Hence, the maximum number you can have in each section in decimal is 255 (256 - 1).

ip bits

The subnet mask separates network and host bits in an IP address. For 32 IP bits, 32 subnet mask bits are used. Subnet mask bits and IP address bits have one-to-one relations. The first subnet mask bit relates to the first IP bit, the second subnet mask bit to 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 : A, B, C, D, and E. Only classes A, B, and C are available for network addressing. You 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 1s in the network bits. They do not have host bits. Since they do not have host bits, and a subnet mask is used to differentiate between host and 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, you 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 set to 1. In slash notation, you will write this subnet mask as /8.

The default subnet mask for a class B network has 16 network bits. In slash notation, it will be /16. The default subnet mask for a class C network 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. You cannot write a host bit between network bits.

network bits and host bits

Subnetting

Subnetting is the process of dividing an IP subnet into smaller subnets. To break an IP subnet, you convert the host bits into network bits. The conversion process starts from the leftmost host bit.

network bits and host bits

When converting bits, you cannot skip any host bit. For example, if you want to split a subnet into two subnets, set the leftmost host bit to 1 to convert it into a network bit. If you want to break it into four subnets, set the two leftmost host bits to 1 to treat them as network bits.

Key points:-
  • A subnet mask is a 32-bit binary address.
  • IP addresses use subnet masks to separate network bits and host bits.
  • Subnet mask bits and IP address bits are in a one-to-one relationship.
  • The first subnet mask bit corresponds to the first IP bit, the second subnet mask bit corresponds to the second IP bit, and so on until the last bit.
  • If the subnet mask bit is 1, the corresponding IP address bit is part of the network address.
  • If the subnet mask bit is 0, the corresponding IP address bit is part of 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 the process of dividing a subnet into multiple subnets.
  • In subnetting, host bits are converted into network bits.
  • Subnetting always starts from the leftmost host bit and goes to the rightmost bit without skipping any bit.

This tutorial is part of the tutorial series "IP Addressing, and Subnetting in Computer Networks Explained with examples". Other parts of this series are the following.
Chapter 01    Introduction to Subnetting
Chapter 02   Network Address Basic Concepts Explained with Examples
Chapter 03   The Subnet Mask and Slash Notation
Chapter 04   Converting Decimal IP Addresses to Binary and Binary to Decimal
Chapter 05   Basic Subnetting in Computer Networks Explained
Chapter 06   Subnetting Tutorial - Subnetting Explained with Examples
Chapter 07   Subnetting Tricks: Subnetting Made Easy with Examples
Chapter 08   FLSM Subnetting and VLSM Subnetting
Chapter 09   VLSM Subnetting Explained with Examples
Chapter 10   VLSM Subnetting Examples and Calculation Explained
Chapter 11   Route Summarization Advantages and Disadvantages
Chapter 12   Supernetting Tutorial: - Supernetting Explained with Examples

Conclusion

An IP address is always written with a subnet mask. It contains a network address and a host address. The subnet mask defines the network and host addresses within the IP address. It also allows you to extend the default network address of the IP address. Extending the default network address is called subnetting. Understanding subnet masks and subnetting is essential for effective network management. Mastery of these concepts enables you to efficiently allocate IP addresses, enhance network security, and ensure optimal network performance.

ComputerNetworkingNotes CCNA Study Guide The Subnet Mask and Slash Notation

We do not accept any kind of Guest Post. Except Guest post submission, for any other query (such as adverting opportunity, product advertisement, feedback, suggestion, error reporting and technical issue) or simply just say to hello mail us ComputerNetworkingNotes@gmail.com