Contents
- 1 Learn to Subnet
- 2 Subnetting Practice
- 3 Bit Patterns of Often Used Subnet Mask Values to Memorize
- 4 Subnetting Cross-reference
- 5 Subnetting – Interesting Octet
- 6 Block Size / Subnet Increment
- 7 Using the AND function to determine the network address
- 8 Broadcast Address
- 9 Wildcard Mask
- 10 Bits Borrowed and Host Bits
- 11 Subnetting Tips/Notes
- 12 Subnet Calculators
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
- CIDR.xyz – An interactive IP address and CIDR range visualizer
Subnetting Practice
Practice make improvement!
- SubnettingQuestions.com: Random Network, Broadcast, First, Last Addresses and Ranges
Bit Patterns of Often Used Subnet Mask Values to Memorize
Bit(s) | Binary | Decimal |
1 | 10000000 | 128 |
2 | 11000000 | 192 |
3 | 11100000 | 224 |
4 | 11110000 | 240 |
5 | 11111000 | 248 |
6 | 11111100 | 252 |
7 | 11111110 | 254 |
8 | 11111111 | 255 |
Subnetting Cross-reference
Subnetting – Interesting Octet
- This “interesting octet” is the last octet in the mask, from the left, with bits turned on.
- Example 1: With a mask of 255.255.240.0, the interesting octet is the 3rd octet, with a value of 240. With 4 bits turned on.
- Example 2: With a mask of 255.192.0.0, the interesting octet is the 2nd octet, with a value of 192. With 2 bits turned on.
- Example 3: With a mask of 255.255.0.0, the interesting octet is the 2nd octet, with a value of 255. With 8 bits turned on.
Block Size / Subnet Increment
- The block size is: 256 – {The interesting octet}
- 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.
- The block size is always less than 256. Because the maximum value an octet can have is 255.
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 (146.47.129.11 IP Address)
11111111.11111111.00000000.00000000 (255.255.0.0 Subnet Mask)
10010010.00101111.00000000.00000000 (146.47.0.0 Network Address) - Same example, using just the “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 (146.47.129.11 IP Address)
x.11111111.x.x (255.255.0.0 Subnet Mask)
x.00101111.x.x (146.47.0.0 Network Address)
- x.00101111.x.x (146.47.129.11 IP Address)
Broadcast 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.
Wildcard Mask
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.
- Example:
- 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)
MicroNugget: Wildcard Masks by Keith Barker
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).
Subnetting Tips/Notes
- If no mask/prefix is given, then borrow bits starting from the “Class” boundary of the IP address.
- If a mask/prefix is given, then the given mask/prefix is the result of subnetting. (Borrow bits from the “Class” boundary to the given mask/prefix.)
- Never abbreviate IP addresses. Always write all four octets for every IP address, including the Broadcast address in a range.
- Calculate the Block Size using the interesting octet, for all problems.
- The total number of subnets must be a power of 2.
- The total number of hosts must be a power of 2.
- Is the question asking for “subnets” or “hosts”
- If you’re asked for the # of hosts, then you must determine how many bits are needed to get that # of hosts, then subtract those bits from the 32 IPv4 bits, to determine the network bits / mask / prefix.
- Determine the number of subnets: 2 [number of bits borrowed].
- Determine the total number of addresses: 2 [the number of host bits].
- Add the Wildcard mask to the network/subnet address to determine the broadcast/last address in the network/subnet.
- Block Size:
- The block size (256 – [The interesting octet]) is best used to determine the increment of the subnets.
- The interesting octet is the last octet, from the left, that you borrowed bits from.
- The “block size” is the increment from one subnet to the next, within the “interesting” octet.
- The “block size” is not the number of addresses per subnet.
- Determine how many addresses to add to the network address/subnet zero to get to the target subnet.
- 1. Multiplying (Subnet “Number”) by the (number of addresses per subnet).
(For the N st, nd, rd, th subnet, subtract 1 before multiplying by the number of addresses per subnet.) - 2. Convert the result to its Base-256 equivalent
- 3. Add the Base-256 equivalent to the original network address of the block to get the network/subnet address of the target subnet.
- 1. Multiplying (Subnet “Number”) by the (number of addresses per subnet).
- The “subnet address” is an alternate term for the “network address” of a subnet.
- Subnet using the methods that work for all subnets, large or small. Switching methods depending on the size of the subnet requires more effort than is necessary.
- Practice makes improvement!
Subnet Calculators
Use the calculators to check your work, not to do the work for you.
- IP Subnet Calculator (Subnet-Calculator.com)
- VLSM Calculator (VLSMCalc.net)
- Network IP and Address Calculator (TuxGraphics.org)