Before reading this article you should have a firm grasp of classful subnetting on the binary level.
Slash Notation
“Slash notation” is the standard way to express an IP Address and Subnet Mask together outside traditional A, B, and C classes. Network professionals will refer to a Subnet Mask of “255.255.255.0” as “slash 24”, but how does one number translate to the other? Instead of writing out a full IP Address and Subnet Mask such as “192.168.100.2 255.255.255.0” it will be written as “192.168.100.2/24” which is much shorter and easier to communicate.
The number after the “/” is the number of binary ones in the Subnet Mask. A “/24” subnet mask is simply 24 binary ones in a row, adding up to “255.255.255.0”.
Example of Slash Notation
H = Host Bit, N = Network Bit
# of new subnets = 2^N bits borrowed
# of usable addresses = (2^H bits)-2 subtract two for unusable Network ID and Broadcast ID
11111111 . 11111111 . 11111111 . 00000000 = /24 = 255.255.255.0
NNNNNNNN . NNNNNNNN . NNNNNNNN . HHHHHHH (no H bits borrowed)
2^N bits borrowed = 1 or 2^0 = 1 subnet
(2^H bits)-2 = 254 or (2^8)-2 = 254 hosts / subnet
11111111 . 11111111 . 11111111 . 10000000 = /25 = 255.255.255.128
NNNNNNNN . NNNNNNNN . NNNNNNNN . NHHHHHH (one H bit borrowed)
2^N bits borrowed = 2 or 2^1 = 2 subnets
(2^H bits)-2 = 126 or (2^7)-2 = 126 hosts / subnet
11111111 . 11111111 . 11111111 . 11000000 = /26 = 255.255.255.192
NNNNNNNN . NNNNNNNN . NNNNNNNN . NNHHHHH (two H bits borrowed)
2^N bits borrowed = 4 or 2^2 = 4 subnets
(2^H bits)-2 = 62 or (2^6)-2 = 62 hosts / subnet
...continuing…
11111111 . 11111111 . 11111111 . 11111100 = /30 = 255.255.255.252
NNNNNNNN . NNNNNNNN . NNNNNNNN . NNNNNNHH (six H bits borrowed)
2^N bits borrowed = 64 or 2^6 = 64 subnets
(2^H bits)-2 = 2 or (2^2)-2 = 2 hosts / subnet
A “/30” subnet is the last usable subnet mask, allowing for only two usable hosts. This is commonly used in point-to-point links between sites and routers to preserve IP addresses. “/31” and “/32” subnet masks are unusable because they allow for less than two usable host addresses.
Basic Subnetting Exercise
For example, given the “192.168.100.0/24” subnet but needing two smaller subnets instead, one could cut the “/24” subnet into two separate “/25” subnets by “borrowing” one bit from the available host bits for networks.
-------------------------------------------------------------
Subnet A (126 Usable IPs, 2 unusable IPs)
192.168.100.0/25 Network ID
192.168.100.1/25 First Usable Host IP
…Usable Host IPs…
192.168.100.126/25 Last Usable Host IP
192.168.100.127/25 Broadcast ID
-------------------------------------------------------------
Subnet B (126 Usable IPs, 2 unusable IPs)
192.168.100.128/25 Network ID
192.168.100.129/25 First Usable Host IP
…Usable Host IPs…
192.168.100.254/25 Last Usable Host IP
192.168.100.255/25 Broadcast ID
-------------------------------------------------------------
Instead of having one large “/24” subnet and procuring another to create the second subnet, the “/24” with 1 network, 254 usable and 2 unusable IP addresses was cut up into a “/25” with 2 networks each having 126 usable and 2 unusable IP addresses.
Unequal CIDR Subnetting Exercise
CIDR is a balancing act between the number of subnets needed and the number of usable IP addresses in those subnets. Let’s do an exercise with unequal CIDR subnets. Given the same “192.168.100.0/24” subnet create two subnets. One subnet must support 60 usable hosts, the other must support 7 usable hosts, saving as many IP addresses for future use as possible.
Standard practice is to configure the larger block of addresses first – the 60 host block. Borrowing 1 host bit will create a subnet having 126 usable addresses (too much waste). Borrowing 2 host bits will create a subnet having 62 usable address – just right. Borrowing 3 host bits will create a subnet having 30 usable addresses – not enough, so this first block will be a “/26” subnet.
-------------------------------------------------------------
Subnet A (62 Usable IPs, 2 unusable IPs)
192.168.100.0/26 Network ID
192.168.100.1/26 First Usable Host IP
…Usable Host IPs…
192.168.100.62/26 Last Usable Host IP
192.168.100.63/26 Broadcast ID
-------------------------------------------------------------
Untouched IPs still available
192.168.100.64 to 192.168.100.255
-------------------------------------------------------------
Now subnet the second block – only 7 hosts. Borrowing 3 host bits will create a subnet having 30 usable addresses – too much. Borrowing 4 host bits will create a subnet having 14 usable address – a little more than needed. Borrowing 5 host bits will create a subnet having 6 usable address – not enough, so we’ll have to borrow 4 bits and have a little left over (no big deal). Here’s how the subnet table looks now…
-------------------------------------------------------------
Subnet A (62 Usable IPs, 2 unusable IPs)
192.168.100.0/26 Network ID
192.168.100.1/26 First Usable Host IP
…Usable Host IPs…
192.168.100.62/26 Last Usable Host IP
192.168.100.63/26 Broadcast ID
-------------------------------------------------------------
Subnet B (14 Usable IPs, 2 unusable IPs)
192.168.100.64/28 Network ID
192.168.100.65/28 First Usable Host IP
…Usable Host IPs…
192.168.100.78/28 Last Usable Host IP
192.168.100.79/28 Broadcast ID
-------------------------------------------------------------
Untouched addresses still available for further subnetting
192.168.100.80 to 192.168.100.255
-------------------------------------------------------------
Differences in Classful and Classless Routing
Unlike classful subnetting that only has subnets of the same size in an address block, CIDR allows for changing subnet masks in order to dynamically size subnets and preserve IP addresses. Classless routing processes (like RIP v2) can process the changing subnet mask. Classful protocols (like RIP v1) cannot process this.
Doing the previous exercise with classful subnetting would have created two subnets with 62 usable IPs in each because classful routing requires the subnet mask not to change. This would be fine for the first subnet but profoundly wasteful in the second subnet. Classless routing processes understand the changing subnet mask, classful processes do not. This is the value of classless subnetting and CIDR.
- "IP Addressing and Subnetting for New Users" Cisco Systems 26 Sep 2005
- "Internet Protocol" Defense Advanced Research Projects Agency Sep 1981
Join the Conversation