What is subnetting?

A close-up of the end of a network cable, with points of multi-coloured light behind it against a black background

If you’ve ever had the chance to work for a larger company, especially one which has multiple offices, you may already know what subnetting is.

But many will go about their jobs without ever knowing the vital role that subnetting plays in day-to-day communication, collaboration, and network security.

Subnetting explanation and benefits

What is subnetting and how does it work?

Subnetting is the creation of a network within a network - a subnetwork, or ‘subnet’. It offers efficiency improvements by reducing the need for network traffic to travel through redundant routers.

Data moving through a subnet can do so as directly as possible. Imagine you were looking to get from your town to one further north, but had to travel via a major city to the east, where you could board a train to your final destination.

Subnetting this example would mean the creation of a dedicated line between your town and the northern one, thereby removing the need to go east at all.

What is a subnet mask?

A subnet mask complements an IP address, determining the subnet to which said address belongs. As with an IP address, a subnet mask is made up of four bytes (32 bits) written in the same notation as an IP address; a typical example would be 255.255.255.0.

Subnet masks are a necessary component for TCP/IP, and split an IP address into its two constituent parts; a host address and a network address.

It is important to understand IP addresses in order to fully comprehend the process of subnetting. IP addresses are combinations of 32-bit numbers, unique for each device, giving a maximum of 4,294,967,296 possible unique addresses in IP address version 4 (IPv4).

They are split into four octets, which is a group of eight bits. The most prevalent visible format of an IP address is created by converting each octet into a decimal, separated by a single dot. 

In an IP address, you’ll find a Network Prefix (or ID) and the Host ID, which can be thought of as two separate fields. These are separated according to the five classes of networks to which the IP address has been assigned.

The classes are named alphabetically, ranging from A to E. In the majority of cases, IP addresses are likely to be placed in the A to C class. Class D is reserved for multicasting, in which a single host can send a stream of data to multiple hosts at the same time. Class E, meanwhile, is reserved for research purposes respectively.

Class A networks use a default subnet mask of 255.0.0.0 and have 0-127 as their first octet. Class B networks use a default subnet mask of 255.255.0.0 and have 128-191 as their first octet. Class C networks use a default subnet mask of 255.255.255.0 and have 192-223 as their first octet.

Why use subnetting?

Subnets improve a network’s efficiency by breaking it up into smaller parts, thereby reducing congestion. In this way, data packets are then able to be sent directly to their destination, avoiding bottlenecks.

Although the IP system made finding specific networks easier, it also introduced hurdles to the transfer of data to specific machines within a network. The networks of large organizations can become particularly inefficient without subnet use.

Organizations can use IP subnets to divide networks by physical constraint, e.g. smaller broadcast domains, or by logical reasoning for features such as firewalls. In this way, subnets guide the routing choices that routers make.

Subnetting is also used to improve network security, as the divisions between each subnet allow organizations to enforce access controls - which also helps to contain any security incidents.

When a computer on one network needs to communicate with a computer on another, it uses a router. A router specified on a host, which connects the host's subnet to other networks, is called a default gateway. This passes traffic on one subnet to devices on other subnets. This gateway often connects the local subnet to the internet.

Rene Millman

Rene Millman is a freelance writer and broadcaster who covers cybersecurity, AI, IoT, and the cloud. He also works as a contributing analyst at GigaOm and has previously worked as an analyst for Gartner covering the infrastructure market. He has made numerous television appearances to give his views and expertise on technology trends and companies that affect and shape our lives. You can follow Rene Millman on Twitter.