A Comprehensive Guide to IP Addressing, Subnets, and Subnet Masks

Try this guide with our instant dedicated server for as low as 40 Euros

subnet masks

Have you ever wondered how your home or office network manages all connected computers and devices?

If you go into the network information of your device, you will get the answer in the form of an IP address – a four-part numeric string that uniquely identifies your device on the Internet and the internal network. 

While you are on the device network information screen, you will also see a subnet address, another numeric string that complements the IP address of your device. 

The IP address and the subnet are critical to the network connectivity and security of your device. 

Subnetting — dividing an IP address space into smaller, easier-to-manage segments — is a common practice that enhances network organization, security, and resource allocation. Admins use subnetting to bring flexibility to network design and systematically allocate IP addresses. 

Whether you are a network administrator, a student learning networking concepts, or an IT professional seeking to refine your skills, mastering subnetting is pivotal for effective IP address management and network optimization.

In this detailed guide to IP addressing and subnetting, we will walk you through the essential steps of subnetting, from breaking down an existing subnet to assigning these subnets to specific devices or network segments. 

Let’s start with a basic introduction to how IP addresses work. 

Table Of Contents

  1. The Idea of Hosts and Networks in an IP Address Scheme
    1. What are IP Addresses?
    2. Hosts and Networks
    3. How Does A Typical TCP/IP Network Work?
    4. What are Subnet Masks?
  2. Network Classes
    1. Class A
    2. Class B
    3. Class C
    4. Class D
    5. Class E
  3. What is Subnetting?
    1. The IP Address Structure
    2. The Subnet Mask
    3. The Process of Subnetting
    4. Benefits of Subnetting
    5. CIDR (Classless Inter-Domain Routing)
  4. Subnet Mask Reference Guide
  5. The Role of Default Gateways
  6. Conclusion
  7. FAQs

The Idea of Hosts and Networks in an IP Address Scheme

Before understanding the idea of hosts and networks in a typical IP addressing scheme, it is vital to understand the anatomy of IP addresses. 

What are IP Addresses?

An IP address is a 32-bit number that a TCP/IP network uses to identify a host (a computer or device, like a printer or router).

IP addresses come in two flavors – the traditional IPv4 (32-bit) and the upcoming IPv6 (128-bit). While IPv4 addresses have been around for two decades, IPv6 addresses are just coming into play. 

A typical IPv4 address is a string of integers separated by periods in the 000.000.000.000 format. 

The system sees an IP address in binary notation to understand how subnet masks distinguish between hosts, networks, and subnetworks. For instance, the binary representation of the dotted-decimal IP address 192.168.111.101 is the 32-bit number 11000000101010000110111101100101. 

This number is again divided into four equal pieces to make it easier to understand in the following format: 11000000.10101000.01101111.01100101. 

Hosts and Networks

IP addresses act as distinct identifiers for each device connected to a network. As such, they are essential to setting up and maintaining networking infrastructure. Network management components use IP addresses for routing data across the Internet and local networks. 

When discussing IP addresses, you should understand networks and hosts, two important concepts that highlight the importance of IP addresses in network management. 

IP Addresses and Subnets

A network is a collection of devices with a common set of IP addresses determined by a subnet mask. This mask designates the portion of the IP address reserved for the network and the hosts. The network address (representing the network) and the broadcast address (used for communication with all devices in the network) are reserved. The remaining addresses in the IP block are allocated to specific hosts and devices in the network.

Hosts are specific hardware components such as PCs, servers, and other networked devices that connect to a specific portion of a larger network. Each host has a unique IP address allocated from the IP address block, allowing for precise package routing and communication between devices.

IP addresses are the foundational aspect of network communication, with networks providing the infrastructure for grouping devices and hosts being the individual entities that send and receive data within those networks. This hierarchical structure ensures efficient and organized data transmission across the interconnected networks and devices.

How Does A Typical TCP/IP Network Work?

A TCP/IP-based WAN operates as a collection of networks. However, the routers that transmit data packets between networks don’t need to know the exact location of the host that a packet of information is meant for. 

Routers are only aware of the network that the host is a part of. They use the data in their route table to determine the host within the network to send the packet. 

For this, an IP address is split into two parts: a network address and a host address. The result is 192.168.111.0 (the network address) and 0.0.0.101 (the host address).

What are Subnet Masks?

subnet mask

Next to IP addresses, a subnet mask is the second component that TCP/IP needs proper network operation. TCP/IP protocol uses the subnet mask to determine connection and routing, whether a host is connected to a nearby subnet or a remote network.


The IP address’s network and host addresses are not fixed in TCP/IP. A subnet mask provides this part of the puzzle. In our example, the subnet mask is 255.255.255.0. 

Now, 255 in binary notation is 11111111. The subnet mask is, therefore, 11111111.11111111.11111111.00000000.

The network and host parts of the address can be separated by aligning the IP address and the subnet mask:

IP address (192.168.111.101): 11000000.10101000.01101111.01100101;

subnet mask (255.255.255.0): 11111111.11111111.11111111.00000000

The network address is the first 24 bits (the number of ones in the subnet mask). The host address is determined by the last 8 bits (the amount of unfilled zeros in the subnet mask). You are provided with the following addresses:

Network address (192.168.111.0): 11000000.10101000.01101111.00000000;

host address(000.000.000.101): 00000000.00000000.00000000.01100101.

Network Classes

Network classes refer to categorizing IP addresses into predefined ranges based on the network size. 

Originally, IP addresses were divided into three main classes: Class A, Class B, and Class C. This classification was established to help allocate IP addresses efficiently to different-sized networks. Each class has a designated range of addresses for the network and host parts.

Here is a brief overview of the traditional network classes:

Class A

  • Range: 1.0.0.0 to 126.255.255.255
  • The first octet illustrates the network, and the next three octets are for hosts.
  • Suitable for large networks with a large number of hosts.

Class B

  • Range: 128.0.0.0 to 191.255.255.255
  • The first two octets illustrate the network, and the next two octets are for hosts.
  • Suitable for medium-sized networks.

Class C

  • Range: 192.0.0.0 to 223.255.255.255
  • The first three octets illustrate the network, and the last is for hosts.
  • Suitable for smaller networks.

Class D

  • Range: 224.0.0.0 to 239.255.255.255
  • Reserved for multicast groups.

Class E

  • Range: 240.0.0.0 to 255.255.255.255
  • Reserved for experimental purposes.

While the concept of network classes laid the groundwork for IP address allocation, it became apparent that the rigid structure didn’t efficiently accommodate the variable needs of different-sized networks. 

This led to the development of Classless Inter-Domain Routing (CIDR), which allows for more flexible allocation of IP addresses by using variable-length subnet masks. CIDR has largely replaced the traditional network classes in modern networking practices.

What is Subnetting?

It becomes essential when you try to connect the logical address system of the Internet (the abstract world of IP addresses and subnets) with the real-world physical networks.

subnetting

Subnetting is a technique to split a large IP address space into smaller, easier-to-manage sub-networks or subnets. 

This technique helps increase network security, maximize IP address utilization, and boost the overall network performance. Subnetting divides an IP network into smaller networks by combining parts of the host section of the IP address. 

Here are the major parts of this process:

The IP Address Structure

An IP address has two parts: the network portion and the host portion. A subnet mask determines the division between these parts.

The Subnet Mask

The subnet mask is a 32-bit number that contains a series of contiguous ‘1’ bits followed by ‘0’ bits. The ‘1’ bits in the subnet mask represent the network portion of the IP address, and the ‘0’ bits represent the host portion.

Adjusting the subnet mask allows you to divide the IP address space into smaller subnets. For example, an IP address space with a subnet mask of 255.255.255.0 (or /24 in CIDR notation) allows for 256 host addresses (2^8). However, we recommend dividing it into much smaller subnets. , but you can further divide it into smaller subnets.

The Process of Subnetting

Choose the number of bits to borrow for subnetting. This determines the number of subnets that you can create in this space. Calculate the new subnet mask based on the borrowed bits. Divide the IP address space into subnets, each with its unique subnet address.

Here’s a scenario that highlights this process: 

Suppose you have been allocated the IP address range of 192.168.0.0 with a subnet mask of 255.255.255.0 for your organization’s network. This means you have 256 addresses (2^8) available within the range of 192.168.0.0 to 192.168.0.255

Now, let’s subnet this range to create smaller subnetworks for different departments:

HR Department:
The HR department needs 30 IP addresses. You can subnet the 192.168.0.0/24 range further by borrowing additional bits for the network portion. 

Let’s borrow 3 bits, which gives you 8 subnets (2^3 = 8) with 32 addresses each.

Subnet 1: 192.168.0.0/27 (30 usable addresses)

Subnet 2: 192.168.0.32/27 (30 usable addresses)

IT Department:
The IT department needs 64 addresses. You can create another set of subnets by borrowing 2 more bits, which gives you 4 subnets with 64 addresses each.

Subnet 1: 192.168.0.64/26 (64 usable addresses)

Subnet 2: 192.168.0.128/26 (64 usable addresses)

Benefits of Subnetting

Now that you know how to create subnets, let’s see the top three benefits of using them for network organization:

  • Efficient IP Address Utilization: Subnetting allows for more efficient use of IP addresses, preventing wastage in large networks.
  • Improved Network Performance: Smaller subnets can reduce broadcast traffic, enhancing network performance.
  • Enhanced Security: Subnets act as natural boundaries, providing a level of security by isolating segments of the network.

CIDR (Classless Inter-Domain Routing)

CIDR is a modern addressing scheme that allows for variable-length subnet masks, providing even more flexibility in subnetting. CIDR notation represents the network address and the subnet mask length (e.g., 192.168.1.0/24).

Subnet Mask Reference Guide

Subnet cheatsheet

Subnet Mask Addresses Hosts The quantity of a Class C
/30 255.255.255.252 4 2 1/64
/29 255.255.255.248 8 6 1/32
/28 255.255.255.240 16 14 1/16
/27 255.255.255.224 32 30 1/8
/26 255.255.255.192 64 62 1/4
/25 255.255.255.128 128 126 1/2
/24 255.255.255.0 256 254 1
/23 255.255.254.0 512 510 2
/22 255.255.252.0 1024 1022 4
/21 255.255.248.0 2048 2046 8
/20 255.255.240.0 4096 4094 16
/19 255.255.224.0 8192 8190 32
/18 255.255.192.0 16384 16382 64
/17 255.255.128.0 32768 32766 128
/16 255.255.0.0 65336 65334 256

 

 

The Role of Default Gateways

A router is typically used when a TCP/IP network needs to communicate with a host on another network. In this case, the router that links a host’s subnet to other TCP/IP networks is a default gateway. 

TCP/IP must choose whether to transmit packets to its default gateway to exchange data with another computer or device connected to the network. 

Here’s a detailed explanation:

 When a host tries to communicate with another device over TCP/IP, it compares the defined subnet mask with the destination IP address and the subnet mask with its own IP address. 

The result of this differentiation informs the computer if the destination is a local host or a remote host. 

If the destination is a local host, the computer will send the packet to the local subnet. If the comparison indicates that the destination is a remote host, the computer will route the packet to the default gateway listed in its TCP/IP settings. The router accepts the packet and forwards it to the appropriate subnet.

Conclusion

The ability to split and assign subnets is a fundamental skill in networking and IP address management. 

Subnetting empowers network administrators to organize and optimize IP address usage, enhance network security through segmentation, and facilitate effective routing. By dividing a larger IP address space into smaller, manageable sub-networks, network resources can be allocated more precisely to suit the unique requirements of different network segments.

We sincerely hope that this post has aided in your exploration of the material on subnetting and subnet masking.

Our support team usually takes care of assigning IP blocks and setting up subnets for the customers. We also help deliver custom IP address requests and help our customers set up subnets for their projects. In fact, IP management is just one entry on our extensive server handover checklist. 

If you’re looking for a robust server for your projects, RedSwitches offer the best dedicated server pricing and deliver instant dedicated servers, usually on the same day the order gets approved. Whether you need a dedicated server, a traffic-friendly 10Gbps dedicated server, or a powerful bare metal server, we are your trusted hosting partner. 

FAQs

Q. What is a subnet?

A subnet, short for subnetwork, is essentially a segment of a larger network. The purpose of a subnet is to split an extensive network into several groups of smaller, interconnected networks to help reduce the traffic load (since fewer hosts share the same network) or to improve security and performance.

Q. How many addresses can be assigned per subnet?

The number of addresses assigned per subnet depends on the subnet mask being used. For example, if you use a subnet mask 255.255.255.0, you can assign up to 254 addresses per subnet.

Q. How do you divide a network into subnets?

Start by determining the required number of subnet bits. The network address and the number of hosts in each subnet determine this. By using subnetting techniques, you can create smaller subnets within a larger network.

Q. What is a public subnet?

A subnet that may be accessed over the Internet is called a public subnet. It allows devices within the subnet to have public IP addresses, which means they can communicate with other devices on the Internet.

Q. What is an Internet gateway?

An Internet gateway is a device that links a local network to the Internet. It acts as a bridge between the local and external networks, allowing devices connected to the local network to access the Internet.

Q. What are class C networks?

Class C networks are a class of IP addresses that have a subnet mask of 255.255.255.0. They are commonly used for small to medium-sized networks and allow up to 254 hosts per subnet.

Q. How do I determine the subnet of an IP address?

An AND logic must be applied between the IP address and the subnet mask to identify the subnet of an IP address. The result will be the network address.

Q. What is network congestion?

When the amount of network traffic surpasses the network’s capacity, it is called network congestion. This can lead to slow performance, delays, and packet loss.

Try this guide with our instant dedicated server for as low as 40 Euros