Subnetting for Linux Administrators
Subnetting lets you divide a network into smaller segments. As a Linux administrator, you need to understand subnetting to configure network interfaces correctly, set up proper routing between segments, and design network architectures that separate traffic by purpose (management, production, storage). You do not need to do binary math from scratch — but you do need to understand what a prefix length means and how to apply it.
Why subnetting matters
- Isolate traffic: management, production, and storage on separate subnets
- Security: subnet boundaries are where firewalls filter traffic
- Routing: the subnet determines whether traffic goes through the gateway or directly to the host
- IP address planning: allocate right-sized subnets for each purpose
Subnet mask and CIDR
/24 subnet example: 192.168.1.0/24
IP address: 192.168.1.10 = 11000000.10101000.00000001.00001010
Subnet mask: 255.255.255.0 = 11111111.11111111.11111111.00000000
|←── network (24 bits) ──→||host bits|
Network: 192.168.1.0 (all host bits = 0)
First host: 192.168.1.1
Last host: 192.168.1.254
Broadcast: 192.168.1.255 (all host bits = 1)
Total usable: 254 addressesCalculating network details
# Use ipcalc for instant subnet calculations (no manual math needed)
sudo apt install -y ipcalc
ipcalc 192.168.1.10/24
ipcalc output
Address: 192.168.1.10 11000000.10101000.00000001. 00001010
Netmask: 255.255.255.0 = 24 11111111.11111111.11111111. 00000000
Wildcard: 0.0.0.255 00000000.00000000.00000000. 11111111
Network: 192.168.1.0/24 11000000.10101000.00000001. 00000000
HostMin: 192.168.1.1 11000000.10101000.00000001. 00000001
HostMax: 192.168.1.254 11000000.10101000.00000001. 11111110
Broadcast: 192.168.1.255 11000000.10101000.00000001. 11111111
Hosts/Net: 254
# Check if two IPs are on the same subnet
ipcalc 10.0.1.5/24
ipcalc 10.0.2.5/24
# Different Network addresses → different subnets → need router to communicate
Subnet reference table
| CIDR | Hosts | Usable | Example use |
|---|---|---|---|
| /8 | 16,777,216 | 16,777,214 | 10.0.0.0/8 — whole enterprise |
| /16 | 65,536 | 65,534 | 10.100.0.0/16 — region/datacenter |
| /24 | 256 | 254 | Most common — one server rack or VLAN |
| /25 | 128 | 126 | Split a /24 in two |
| /26 | 64 | 62 | Small segment (management network) |
| /27 | 32 | 30 | Cluster segment |
| /28 | 16 | 14 | Small DMZ |
| /29 | 8 | 6 | Point-to-point with a few extra hosts |
| /30 | 4 | 2 | Point-to-point router links |
| /32 | 1 | 1 | Single host route |
Practical subnetting examples
# Scenario: Design network for a data center server rack
# Allocate from 10.10.0.0/16
# Management VLAN (servers + switches): /26 = 62 hosts
# 10.10.1.0/26 (hosts: 10.10.1.1 - 10.10.1.62, broadcast: 10.10.1.63)
# Production VLAN (application servers): /24 = 254 hosts
# 10.10.2.0/24 (hosts: 10.10.2.1 - 10.10.2.254)
# Storage VLAN (iSCSI/NFS): /25 = 126 hosts
# 10.10.3.0/25 (hosts: 10.10.3.1 - 10.10.3.126)
# Calculate each subnet
ipcalc 10.10.1.0/26
ipcalc 10.10.2.0/24
ipcalc 10.10.3.0/25
Conclusion
You need to understand subnetting to configure servers correctly: when you type 192.168.1.10/24, you are saying the server is on the 192.168.1.0/24 network (254 hosts). Traffic to any 192.168.1.x address goes directly; everything else goes through the gateway. Use ipcalc for quick calculations rather than mental binary math. Design server networks with the right-sized subnet: /24 for a typical server segment, /26 or /27 for management networks, /30 for point-to-point links.
FAQ
Is Subnetting for Linux Administrators important for Ubuntu administrators?+
Yes. It supports practical Ubuntu administration because it connects directly to server reliability, security, troubleshooting, or daily operations.
Should I practice this on a live server?+
Use a lab VM first. After you understand the command output and rollback path, apply the workflow carefully on real systems.
What should I do after reading this article?+
Run the practice commands, write down what each one shows, and continue to the next article in the Ubuntu roadmap.
Need help with Ubuntu administration?
Work directly with Muhammad Irfan Aslam for Ubuntu Server, Linux, cloud, Docker, DevOps, CI/CD, or infrastructure troubleshooting support.
Hire Me for Support