Learn to Subnet
Pay attention to whether the examples excludes or includes Subnet Zero. Do not get into the habit of assuming the expected result is for the usable hosts. We always include subnet zero when determining the total number of addresses in the subnet. Never subtract 2, for the network and broadcast addresses, unless specifically asked for usable hosts.
- Learn to Subnet (Charles C. Botsford) (LearnToSubnet on YouTube)
- Chapter 4 – Subnetting (Microsoft Docs)
- IP Subnetting Made Easy: George Ou explains IP subnetting using his own graphical approach. It’s a great primer for students and a nice refresher for others. (TechRepublic.com)
- IP Addressing and Subnetting for New Users (Cisco.com)
- Understanding IP Addressing (by Chuck Semeria)
- Understanding IP Addressing: Everything You Ever Wanted To Know – By 3Com / Chuck Semeria
- Using /31 subnets on point-to-point links (PacketLife.net)
- Professor Messer – Seven Second Subnetting
- Build Your Skills: Subnetting and supernetting IP networks
- Note: This article excludes subnet zero and the broadcast subnet for the whole address block, but we always include both in our calculations
- Calculate Network, Broadcast and host addresses by ciscoKim
- Concepts in IP Addressing (InformIT.com)
- How a Broadcast Address Works
Practice make improvement!
- SubnettingQuestions.com: Random Network, Broadcast, First, Last Addresses and Ranges
Subnetting – Interesting Octet
- This “interesting octet” is the last octet in the mask, from left to right, with bits turned on. i.e. 1
- Example: With a mask of 255.255.240.0, the interesting octet is the 3rd octet, with a value of 240. 4 bits turned on.
- Example: With a mask of 255.192.0.0, the interesting octet is the 2nd octet, with a value of 192. 2 bits turned on.
- Example: With a mask of 255.255.0.0, the interesting octet is the 2nd octet, with a value of 255. 8 bits turned on.
Block Size / Subnet Increment
- The block size is the increment from one subnet to the next.
- The block size is not the number of addresses per subnet.
- The block size must be a power of 2
Determine the Block Size: Method 1
- The block size/subnet increment is determined by the bit position of the “interesting octet” of the mask.
- e.g. If you have an interesting octet value of 192, you’re using 2 bits, and the value of the position of the 2nd bit, from the left is 64. So the block size is 64.
|Bit position||1 bit||2 bits||3 bits||4 bits||5 bits||6 bits||7 bits||8 bits|
|Value of bit position/Block Size||128||64||32||16||8||4||2||1|
Determine the Block Size: Method 2
- The block size/subnet increment is determined by subtracting the value of the “interesting octet” of the mask, from 256.
Examples of determining the Block Size
|Prefix||Subnet Mask||Interesting Octet||Bit Value or (Calculation)||Block Size|
|/26||255.255.255.192||4th octet||value of the 2nd bit or (256 – 192) =||64|
|/18||255.255.192.0||3rd octet||value of the 2nd bit or (256 – 192) =||64|
|/24||255.255.255.0||3rd octet||value of the 8th bit or (256 – 255) =||1|
Using the AND function to determine the network address
- Use the bitwise AND to determine the network address by comparing the binary of the subnet mask to the binary of an IP address.
- If both bits in the column are 1, the bit in the resulting binary representation is 1, (1 × 1 = 1);
- Otherwise, the result is 0 (1 × 0 = 0 or 0 × 0 = 0)
- Example: (the interesting octet, is the 2nd octet)
10010010.00101111.10000001.00001011 (220.127.116.11 IP Address)
11111111.11111111.00000000.00000000 (255.255.0.0 Subnet Mask)
10010010.00101111.00000000.00000000 (18.104.22.168 Network Address)
- Same example, but using the just “interesting octet” of the IP address instead of the whole IP address. Note: All bits after the interesting octet will be zero.
- x.00101111.x.x (22.214.171.124 IP Address)
x.11111111.x.x (255.255.0.0 Subnet Mask)
x.00101111.x.x (126.96.36.199 Network Address)
- x.00101111.x.x (188.8.131.52 IP Address)
- Add the Wildcard Mask to the network address to determine the broadcast address
- Or subtract 1 from the next subnet address to determine the broadcast address of the previous subnet.
Default Mask vs Mask
- Default Mask is when there is no subnetting or supernetting.
Using the Wildcard mask to determine the last address (a.k.a. broadcast address) within a subnet.
- For subnetting, the Wildcard mask is the inverse of the subnet mask
- Each octet of the subnet mask, and its corresponding wildcard mask, must add up to 255.
- If you have a /26 prefix, the dotted-decimal mask would be: 255.255.255.192, and then the Wildcard mask would be: 0.0.0.63. (As 192 + 63 = 255 in the 4th octet)
Bits Borrowed and Host Bits
If you’re starting with the “Number of Needed Hosts“, then:
- Subtract the number of host bits from the 32 IPv4 bits. Leaving the (network bits used).
- Then subtract the number of (default mask network bits) from (network bits used), resulting in the (number of bits borrowed).
Use the calculators to check your work, not to do the work for you.