Updated: July 19, 2025

In the world of computer networking, IP addressing and subnetting form the foundation of how devices communicate with each other over the internet or within private networks. Whether you are a network administrator, an IT student, or a curious enthusiast, understanding these concepts is essential for managing networks efficiently and securely. This article will explain the basics of IP addressing and subnetting, breaking down complex ideas into easily digestible pieces.

What is an IP Address?

An IP address (Internet Protocol address) is a unique identifier assigned to each device connected to a network that uses the Internet Protocol for communication. It functions similarly to a postal address, ensuring that data packets sent over a network reach the correct destination.

IPv4 vs IPv6

There are two main versions of IP addresses in use:

  • IPv4: The most common version, consisting of 32 bits, typically written in dotted decimal format (e.g., 192.168.1.1). It provides around 4.3 billion unique addresses.
  • IPv6: Developed to address the shortage of IPv4 addresses, IPv6 uses 128 bits, written in hexadecimal format separated by colons (e.g., 2001:0db8:85a3::8a2e:0370:7334). It offers an almost limitless number of addresses.

While IPv6 adoption is growing, IPv4 remains predominant globally.

Structure of an IPv4 Address

An IPv4 address consists of four octets (8 bits each), separated by periods. Each octet ranges from 0 to 255. For example:

192.168.10.15

The 32 bits can be divided into two main parts:

  • Network portion: Identifies the specific network.
  • Host portion: Identifies the individual device (host) within that network.

The division between these sections depends on the class of the IP address or the subnet mask applied.

IP Address Classes

Historically, IP addresses were divided into five classes (A through E), with Classes A, B, and C being most common for general networking.

Class First Octet Range Default Subnet Mask Number of Networks Hosts per Network
A 1-126 255.0.0.0 (/8) 128 ~16 million
B 128-191 255.255.0.0 (/16) 16,384 ~65,000
C 192-223 255.255.255.0 (/24) 2 million+ 254
D 224-239 Reserved for multicast N/A N/A
E 240-255 Experimental/Research use N/A N/A

Note:

  • The first octet range excludes some reserved addresses (e.g., 127.x.x.x is reserved for loopback).
  • The default subnet mask helps determine where the network portion ends and the host portion begins.

For example, a Class C address like 192.168.1.10 with a default subnet mask of 255.255.255.0 means:

  • Network portion: first three octets (192.168.1)
  • Host portion: last octet (10)

What is a Subnet Mask?

A subnet mask is used to divide an IP address into its network and host portions by masking bits in the IP address.

It works by using a series of consecutive ones (1s) followed by zeros (0s). The ones represent the network bits; zeros represent host bits.

For example:

Subnet Mask: 255.255.255.0
Binary:     11111111.11111111.11111111.00000000

This indicates that the first three octets belong to the network, and only the last octet is available for hosts.

How Subnet Masks Work

When you perform a bitwise AND operation between an IP address and its subnet mask, you get the network address.

Example:

  • IP Address: 192.168.1.1011000000.10101000.00000001.00001010
  • Subnet Mask: 255.255.255.011111111.11111111.11111111.00000000

Performing bitwise AND:

11000000 & 11111111 = 11000000
10101000 & 11111111 = 10101000
00000001 & 11111111 = 00000001
00001010 & 00000000 = 00000000

Resulting in 192.168.1.0, which identifies the network itself.

Why Subnetting is Important

Subnetting allows you to split a large network into smaller logical segments called subnets or sub-networks.

Benefits of Subnetting

  1. Improves Network Performance: Reduces broadcast traffic by confining it to smaller subnets.
  2. Enhances Security: Limits access between different subnets.
  3. Efficient Use of IP Addresses: Helps allocate IP addresses more effectively by avoiding wastage.
  4. Simplifies Management: Easier to manage smaller groups of devices.
  5. Supports Hierarchical Routing: Makes routing tables smaller and more efficient.

How Does Subnetting Work?

Subnetting modifies the default subnet mask by borrowing bits from the host portion to create additional networks or subnets.

Example

Suppose you have a Class C network 192.168.1.0 with default subnet mask 255.255.255.0. This gives you:

  • Number of hosts: (2^8 – 2 = 254) hosts per network (subtracting network and broadcast addresses)

If you want to divide this into smaller networks (subnets), say four subnets, you borrow bits from the host part.

  • Borrowed bits: (2) (because (2^2 =4))
  • New subnet mask:
Original host bits:      8
Borrowed bits for subnet:2
Remaining host bits:     6

Subnet mask in binary:
11111111 . 11111111 . 11111111 . 11000000
Which equals:
255      . 255      . 255      . 192

This new mask 255.255.255.192 creates four subnets:

Subnet Number Network Address Usable Host Range Broadcast Address
0 192.168.1.0 192.168.1.1 – 192.168.1.62 192.168.1.63
1 192.168.1.64 192.168.1.65 – 192.168..126 192..168..191

Each subnet can support up to (2^6 -2 =62) hosts.

Calculations Involved in Subnetting

When subnetting, you mainly calculate:

  • Number of subnets: (2^n), where n = number of borrowed bits.
  • Number of hosts per subnet: (2^h -2), where h = number of remaining host bits.

The subtraction by two accounts for:
– Network ID (all host bits zero)
– Broadcast address (all host bits one)

Understanding CIDR Notation

Classful addressing has limitations leading to inefficient usage of IP addresses; thus, Classless Inter-Domain Routing (CIDR) was introduced.

CIDR notation expresses an IP address accompanied by its prefix length , the number of bits set in the subnet mask, to specify how many bits belong to the network part.

Example:

192..168..1..0/24

Here /24 means that first 24 bits are network bits (255..255..255..0).

CIDR allows flexible allocation regardless of classes and is widely used today.

Special IP Addresses

Several special IP addresses are reserved for specific purposes:

  • Network Address : All host bits zero , identifies a subnet or entire network.
  • Broadcast Address : All host bits one , used to send messages to all devices on that subnet.
  • Loopback Address : 127.x.x.x , used for internal testing on a device.
  • Private Addresses : Reserved ranges not routable on public internet but used inside private networks:
10..0..0..0 -10..255..255..255    (Class A)
172..16..0..0 -172..31..255..255 (Class B)
192..168..0..0 -192..168..255..255(Class C)

Practical Example

Let’s apply what we’ve learned with an example scenario where you need to design a small office network.

Scenario

You have a single Class C block: 192..168..100..0/24. You need four separate departments with up to fifty devices each.

Step-by-step Solution

1.) Calculate required hosts per subnet:

  • Each department needs at least fifty hosts.
  • Number of hosts must be ( \geq50 ).

Calculate minimum host bits ((h)) such that (2^h -2 \geq50):

h =6 because \(2^6 -2 =62\) which covers at least fifty devices.

2.) Calculate borrowed subnet bits ((n)):

Total host bits in Class C =8;

Borrowed bits = (8 – h =8 -6=2).

3.) Number of subnets possible:

(2^n =2^2=4). Perfect for your four departments!

4.) New subnet mask:

Borrowing two bits means subnet mask is:
11111111 .11111111 .11111111 .11000000 

Decimal:
255 .255 .255 .192

5.) Define subnets:

Subnet # Network Address Usable Host Range Broadcast Address
0 192..168..100..0 192..168..100..1 -62 192..168..100..63
1 192..168..100..64 65 -126 127
2 128 129 -190 191
3 192 193 -254 254

Each department gets its own range without overlapping!

Tools for Subnetting

Manual calculations can be tedious; many tools exist online and as software utilities that help perform quick computations related to IP addressing and subnetting:

  • Subnet calculators (web apps or command-line tools)
  • Network simulators like Cisco Packet Tracer
  • Built-in OS commands (ipconfig, ifconfig, etc.)

Learning how these tools work alongside understanding fundamentals enhances problem-solving skills in real-world environments.

Summary

Understanding IP addressing and subnetting is critical for efficient network design, organization, and troubleshooting.

Key points covered include:

  • The structure and purpose of IPv4 addresses.
  • The role and function of subnet masks.
  • How subnetting divides networks into manageable segments.
  • CIDR notation enabling flexible allocation beyond classful boundaries.
  • Practical examples demonstrating how to create subnets according to requirements.

Mastering these concepts empowers professionals to build scalable networks that optimize performance while maintaining security and manageability in today’s interconnected digital landscape.


By gaining proficiency in IP addressing and subnetting fundamentals, you’re well-positioned to explore advanced topics like routing protocols, VLANs, NAT configurations, and more, further enhancing your networking expertise!