If you use the internet in a corporate organization, it’s almost certainly part of a subnet. But what is a subnet, why is subnetting important, and how do you find out what subnet you are on?

A subnet, short for subnetwork, is a network within a network. If you divide a network into smaller, individual networks, those networks become subnets. Find out all about how subnets work with this comprenhensive guide.

How Does Subnetting Work?

Subnetting is the practice of creating subnets—dividing a network or IP address into smaller networks.

You can think of subnetting as dividing a network in a similar way to how you might divide a building. A building has an address which everyone outside of that building uses to identify it. But the building also has many rooms. These rooms are all in one building, at the same address, but within the building they also have ‘sub-addresses’ to define them: the study, room 101, etc.

Before you can understand how subnetting actually works, you need to know what an IP address is.

Subnetting and IPv4 Addresses

An IP (Internet Protocol) address is a way of uniquely identifying devices on a local network or on the internet. The IP address allows your computer to exchange information with other computers around the world. IP addresses have several properties including:

  • Duration: static / dynamic
  • Scope: private / public
  • Size: IPv4 / IPv6

RELATED: What Is an IP Address and Can It Show Where You Live?

The IPv4 is a 32-bit address, while IPv6 is 128-bit to cater for larger demands. An IPv4 address uses numeric values such as 192.168.1.31 while an IPv6 address uses hexadecimal values like 2001:0db8:85a3:0000:0000:8a2e:0370:7334.

Subnetting makes the use of the internet more efficient because IP addresses shaing an address are, in effect, closer together. Instead of network traffic going through many routers to find a specific device, traffic goes to the router in charge of a specific network.

Revisiting the building example, imagine you had to deliver a package to room 74. Instead of having to check all the rooms on every floor, subnetting tells you that that room is on the seventh floor. You take an elevator to the seventh floor and deliver your package much faster.

What Is a Subnet Mask?

Computers in a subnetwork have IP addresses that all start with the same prefix. This prefix can vary in length, depending on how big the network needs to be. A subnet mask identifies the length of this prefix and, therefore, the size of the network.

A subnet mask is usually in dot decimal notation, just like an IP address. It describes, for IPv4 addresses within the network, which part is the network ID and which part is the host ID.

How Do You Calculate Subnets?

Like IPv4 addresses, subnet masks are 32-bit addresses made up of four groups of 8 bytes. And they are in the format 255.255.255.255 (decimal) or 11111111.11111111.11111111.11111111 (binary)

The /24 network is the most popular subnet mask. It’s equivalent to the 255.255.255.0 subnet mask. This means that IP addresses within the network share the same prefix for the first three parts of their four-part address.

In binary, this subnet mask is 11111111.11111111.11111111.00000000. A /24 network has a total of 256 addresses to represent devices that are part of it.

Note: The last eight bits are all zeroes. The bits in a mask can only be zeroes from right to left, there cannot be an address with a zero in the middle, such as 11111011.

Subnetting Cheat Sheet

subnet-cheatsheet

In the above table, CIDR stands for Classless Inter-Domain Routing. Here, it represents the subnet prefix bit-length. As the bit-length increases, the number of possible hosts halves. The total number of hosts that IPv4 can address is 2^32.

The table headers represent the subnet masks and x represents the number we want to calculate. A /1 network contains IPs that start with a single fixed bit (0 or 1). 31 bits then follow to identify individual hosts within this huge network. This means there are only two possible /1 subnets, each with two billion hosts it can address: 0.0.0.0–127.255.255.255 (these all start with a zero bit) and 128.0.0.0–255.255.255.255 (all starting with a one).

The subnet mask of a /1 network is 10000000.00000000.00000000.00000000 in binary and 128.0.0.0 in decimal.

A /12 network has a mask starting with 12 1 bits: 1111111.11110000.00000000.00000000. This is 255.240.0.0 in decimal, so x is 240.

Doing this for every network is cumbersome, so the cheat sheet can speed things up. This is where the cheat sheet comes in. Replace the value of x in a subnet mask with the number on the last row of the column (CIDR) you’re looking for. Using the cheat sheet, you can determine:

/24 = 255.255.255.0

/12 = 255.240.0.0

/17 = 255.255.128.0

Example 1

192.168.1.0/24

Subnet mask: 255.255.255.0

Hosts: 2^(32-24) = 2^8 = 256

Active hosts: Hosts - 2 = 254

Network ID (first address): 192.168.1.0

Broadcast ID(last address): 192.168.1.255 (0 to 255 is 256 integers.)

Example 2

192.168.1.16/28

Subnet mask = 255.255.255.240

Hosts: 2^(32-28) = 2^4 = 16

Active hosts = Hosts - 2 = 14

Network ID: 192.168.1.16

Broadcast ID: 192.168.1.31 (16 to 31 is 16 integers)

How Do I Know What Subnet Mask I Am On?

If you use Windows, go to Command Prompt and enter the ipconfig command. It should display something like this:

subnet-windows

If you use Linux, run the ifconfig command in your terminal:

subnet-linux

What Are the Advantages of Subnetting?

Why is subnetting important? Subnetting has many advantages, but these three are the most significant:

CHIOMA SUBNETTING-01

Performance

Subnets make networks more efficient. Subnetting allows traffic to travel a shorter distance, not having to pass through unnecessary routers along the way. This improves the performance by reducing network congestion and speeding up traffic.

Organization

Subnetting makes it easier and more efficient to group different devices. For example, a company might have an accounting department with some privileges that other departments should not have. A subnet containing just the accounting department would ensure that other devices cannot access that network. This makes organization more efficient and allows the network to implement exclusivity.

Security

Because subnets separate and group smaller networks, it is easier to isolate and identify threats in a particular network.

What Are the Disadvantages of Subnetting?

Subnetting is quite expensive and requires professional knowledge to implement.

Subnetworks can be wasteful, depending on how you divide them up. For example, each subnetwork requires a network ID and a broadcast ID, two IPs that it needs to reserve from the total pool.

Subnetting and IP Conflicts

Imagine if every building in the world had a single unique number instead of a hierarchical address. Delivering mail or visiting someone’s house would be a nightmare! Instead, we usually organize addresses by levels of granularity: country, city, street, etc.

Subnetting is the internet equivalent. It’s essential for the organization of networks to route traffic efficiently.

Subnetting also helps to avoid problems like IP conflicts. An IP address conflict happens when two devices on the same network have the same IP address.