IP Addressing and Subnetting
From the Networking 141 curriculum
TL;DR
IP addressing uniquely identifies devices on a network, much like a street address. Subnetting then lets you divide a larger network into smaller, more manageable segments. This improves efficiency and security by controlling traffic flow within an organization.
1. The Mental Model
Think of an IP address as your house address, complete with a street name and house number. Subnetting is like dividing a very long street into several smaller blocks, each with its own range of house numbers, making it easier to find specific houses and manage local traffic.
2. The Core Material
IP addresses are fundamental to how devices communicate on a network. We primarily deal with IPv4, which uses 32 bits, usually written as four decimal numbers separated by dots (e.g., 192.168.1.1). Each number can range from 0 to 255.
An IP address actually has two parts: the network portion and the host portion. The network portion identifies which network a device belongs to, and the host portion identifies the specific device within that network.
The subnet mask tells a device which part of an IP address is the network portion and which is the host portion. It's also a 32-bit number, usually written in the same dotted-decimal format (e.g., 255.255.255.0). Where there's a '1' in the subnet mask's binary form, that bit in the IP address belongs to the network portion. Where there's a '0', it belongs to the host portion.
You'll often see IP addresses written with a /CIDR (Classless Inter-Domain Routing) notation, like 192.168.1.0/24. The /24 means the first 24 bits of the IP address are the network portion, and the remaining 8 bits are for hosts. This is just a shorthand for the subnet mask (a /24 subnet mask is 255.255.255.0).
What is Subnetting?

Photo by Ann H on Pexels
Subnetting is the process of taking bits from the host portion of an IP address and using them for a subnet portion. This creates smaller, separate networks (subnets) from one larger network.
Why subnet?
* Efficiency: Reduces broadcast traffic, as broadcasts are confined to their subnet.
* Security: Isolates network segments, making it harder for unauthorized access to spread across the entire network.
* Organization: Makes network management easier by grouping devices logically (e.g., by department or physical location).
* Resource Management: Allows for more efficient use of IP addresses.
How Subnetting Works (The Math)

Photo by Dione Neris on Pexels
When you subnet, you "borrow" bits from the host part to create new network IDs.
Let's say you have the network 192.168.1.0/24. This means:
* Network bits: 24
* Host bits: 32 - 24 = 8
With 8 host bits, you can have 2^8 = 256 possible IP addresses. However, two addresses are reserved:
* The network address (all host bits 0) – identifies the subnet itself.
* The broadcast address (all host bits 1) – sends data to all devices on that subnet.
So, 256 - 2 = 254 usable host addresses.
If you decide to subnet this /24 network further, you borrow bits from those 8 host bits.
For example, if you borrow 1 bit from the host portion:
* New network bits: 24 + 1 = 25
* New host bits: 8 - 1 = 7
* Number of new subnets: 2^1 = 2 subnets
* Number of hosts per subnet: 2^7 - 2 = 128 - 2 = 126 usable hosts
If you borrow 2 bits from the host portion:
* New network bits: 24 + 2 = 26
* New host bits: 8 - 2 = 6
* Number of new subnets: 2^2 = 4 subnets
* Number of hosts per subnet: 2^6 - 2 = 64 - 2 = 62 usable hosts
The key formulas are:
* Number of subnets = 2^n (where 'n' is the number of bits borrowed from the host portion)
* Number of hosts per subnet = 2^h - 2 (where 'h' is the number of remaining host bits)
Here's how borrowing bits changes things:
graph TD
A["Original Network (e.g., 192.168.1.0/24)"] --> B["Identify Network and Host Portions"]
B --> C{"Need more subnets or fewer hosts per subnet?"}
C -- "Need more subnets" --> D["Borrow Host Bits for Subnet ID"]
D --> E["Calculate New Subnet Mask (Prefix Length)"]
E --> F["Calculate Number of New Subnets (2^borrowed_bits)"]
E --> G["Calculate Hosts per Subnet (2^remaining_host_bits - 2)"]
F & G --> H["Define Each Subnet's Address Range"]
H --> I["Assign IP Addresses to Devices within Subnets"]
3. Worked Example
Let's say your company has been assigned the network 172.16.0.0/16. You need to create 50 subnets for different departments.
-
Identify initial parameters:
- Network: 172.16.0.0
- Original subnet mask: /16 (255.255.0.0)
- Network bits: 16
- Host bits: 32 - 16 = 16
-
Determine bits to borrow for subnets:
You need at least 50 subnets.- If you borrow 5 bits: 2^5 = 32 subnets (not enough)
- If you borrow 6 bits: 2^6 = 64 subnets (this works!)
-
Calculate new subnet mask and host bits:
- Borrowed bits: 6
- New network bits (subnet mask): 16 (original) + 6 (borrowed) = 22 bits.
The new subnet mask is /22. In dotted-decimal, this is 255.255.252.0.
(16 ones, then 6 ones, then 10 zeros: 11111111.11111111.11111100.00000000) - Remaining host bits: 16 (original) - 6 (borrowed) = 10 bits.
-
Calculate hosts per subnet:
- With 10 host bits, you get 2^10 - 2 = 1024 - 2 = 1022 usable hosts per subnet.
-
List the first few subnets:
The network portion now extends into the third octet. Each time the 6 borrowed bits change, you get a new subnet.- Subnet 0: 172.16.0.0/22
- Host range: 172.16.0.1 to 172.16.3.254
- Broadcast: 172.16.3.255
- Subnet 1: 172.16.4.0/22
- Host range: 172.16.4.1 to 172.16.7.254
- Broadcast: 172.16.7.255
- Subnet 2: 172.16.8.0/22
- Host range: 172.16.8.1 to 172.16.11.254
- Broadcast: 172.16.11.255
- ...and so on, for 64 total subnets. The blocks of 4 in the third octet (0, 4, 8, 12, etc.) are determined by the 2^h formula where h is the number of remaining host bits in that specific octet when you apply the subnet mask (in this case 2 bits, so 2^2=4).
- Subnet 0: 172.16.0.0/22
4. Key Takeaways
- An IP address identifies a device, while a subnet mask tells you which part is the network and which is the host.
- The CIDR notation (e.g., /24) is a shorthand for the subnet mask, indicating the number of network bits.
- Subnetting divides a larger network into smaller, more efficient segments.
- You borrow bits from the host portion of an IP address to create new subnets.
- More borrowed bits mean more subnets but fewer hosts per subnet.
- Each subnet has a network address and a broadcast address that cannot be assigned to devices.
Common Mistakes to Avoid:
- Forgetting that the network and broadcast addresses are unusable for hosts.
- Confusing the number of borrowed bits with the number of remaining host bits.
- Incorrectly calculating the new subnet mask after borrowing bits.
- Not accounting for the need for at least two usable IP addresses per subnet (for the network and broadcast addresses).
5. Now Try It
You're given the network 192.168.10.0/24. You need to create at least 10 subnets for various remote offices, with each subnet supporting at least 15 usable hosts.
- How many bits do you need to borrow from the host portion to create at least 10 subnets?
- What is the new CIDR notation (e.g., /xx) and dotted-decimal subnet mask?
- How many usable hosts will each of these new subnets support?
- List the network address, first usable host, last usable host, and broadcast address for the first two new subnets you create.
Success means you've correctly calculated the bits needed, the new subnet mask, host count, and can identify the key addresses for the first couple of subnets.
Frequently asked about IP Addressing and Subnetting
Study this next
Get the full Networking 141 curriculum
Clone the complete plan to your dashboard for unlimited AI-generated notes, practice quizzes, and a personalised revision schedule.
Save this course free