By the end of this lesson, you will:
Every device on a network requires a unique address to communicate, just like every house needs an address for mail delivery. In networking, IP addresses perform this role. Subnetting helps optimize the allocation of these addresses by dividing a large network into smaller, more efficient sub-networks.
In this chapter, we’ll explore the fundamentals of IP addressing and subnetting, with a strong emphasis on practical exercises.
An IP address is a numerical label assigned to every device connected to a network. It has two versions: IPv4 and IPv6. For this chapter, we’ll focus on IPv4.
192.168.1.1
).0
to 255
.192.168.10.12
).Feature | IPv4 | IPv6 |
---|---|---|
Address Length | 32 bits | 128 bits |
Total Addresses | ~4.3 billion | ~340 undecillion |
Address Format | Dotted decimal (e.g., 192.168.1.1 ) |
Hexadecimal (e.g., 2001:0db8::1 ) |
Scalability | Limited, relies on NAT | Virtually limitless, NAT unnecessary |
Security | Optional (e.g., IPSec) | Built-in with mandatory IPSec |
Simplicity | Complex routing with NAT | Simplified routing |
The Internet of Things (IoT) refers to billions of interconnected devices—from smart thermostats to industrial sensors—that communicate over the Internet.
Smart Home:
Imagine a home with the following devices:
IPv4 Problem:
IPv6 Solution:
2001:db8::1
for the thermostat).Subnetting divides a single large network into smaller, manageable sub-networks (subnets). This helps improve performance, security, and efficient IP address allocation.
A subnet mask defines which part of an IP address is the network portion and which is the host portion.
192.168.1.1
255.255.255.0
(equivalent to /24
in CIDR notation).Classless Inter-Domain Routing (CIDR) is a shorthand way to represent the subnet mask.
/24
means the first 24 bits are for the network, and the remaining bits are for hosts.2n2^nWhere nn is the number of borrowed bits from the host portion.
2h−22^h – 2Where hh is the number of remaining host bits. Subtract 2 for the network and broadcast addresses.
256−Subnet Mask of Last Octet256 – \text{Subnet Mask of Last Octet}
192.168.1.0/26
255.255.255.192
/24
to /26
).192.168.1.0/26
, 192.168.1.64/26
, 192.168.1.128/26
, 192.168.1.192/26
.Given:
10.0.0.0/22
255.255.252.0
.22 - 16 = 6
.10.0.0.0 - 10.0.3.255
10.0.4.0 - 10.0.7.255
10.0.8.0 - 10.0.11.255
Given:
192.168.10.50/27
./27
= 255.255.255.224
.192.168.10.32
.192.168.10.63
.192.168.10.32
.192.168.10.63
.192.168.10.33 - 192.168.10.62
.Requirement:
192.168.1.0/24
./26
(Subnet Mask = 255.255.255.192
).192.168.1.0 - 192.168.1.63
(Valid Hosts: 192.168.1.1 - 192.168.1.62
).192.168.1.64 - 192.168.1.127
(Valid Hosts: 192.168.1.65 - 192.168.1.126
).192.168.1.128 - 192.168.1.191
(Valid Hosts: 192.168.1.129 - 192.168.1.190
).192.168.1.192 - 192.168.1.255
(Valid Hosts: 192.168.1.193 - 192.168.1.254
).192.168.20.0/26
, calculate:
2001:db8:1::/64
.2001:db8:2::/64
.In the next chapter, we’ll compare IPv4 and IPv6, exploring the need for the transition and the new features of IPv6.
Your subnetting skills are leveling up—let’s keep building! 🚀