CIDR was introduced by the IETF in 1993 to replace the classful addressing system. It removes the restriction that Class A networks must use /8, Class B must use /16, and Class C must use /24. This flexibility allows larger networks to be split into smaller networks called subnets, enabling greater efficiency in IP address allocation and reducing address waste.
The original classful system led to massive IP address waste. For example, a point-to-point connection between two routers using a Class C network (/24) would waste 252 addresses since only 2 addresses are needed. Similarly, a company needing 5,000 hosts would require a Class B network, wasting approximately 60,000 addresses. Subnetting solves this by allowing networks to be divided into appropriately-sized segments.
Subnetting involves borrowing bits from the host portion of an IP address and adding them to the network portion. Each borrowed bit doubles the number of possible subnets while halving the number of available host addresses per subnet. The formula for calculating usable hosts is 2^n - 2, where n is the number of host bits, and we subtract 2 for the network and broadcast addresses.
FLSM is a subnetting method where all subnets use the same prefix length. For example, dividing a /24 network into four equal subnets using /26 throughout. While simpler to implement, FLSM can lead to inefficient address usage when network segments have varying host requirements.
VLSM allows the creation of subnets with different sizes to match actual host requirements more efficiently. The process involves assigning the largest subnet first at the start of the address space, then proceeding to smaller subnets in descending order. This method maximizes address space efficiency by tailoring each subnet size to its specific needs.
Class
First Octet Range
Default Prefix
Addresses per Network
A
0-127
/8
16,777,216
B
128-191
/16
65,536
C
192-223
/24
256
D
224-239
N/A (Multicast)
N/A
E
240-255
N/A (Reserved)
Number of Subnets = 2^x (where x = borrowed bits)
Number of Usable Hosts = 2^n - 2 (where n = host bits)
Block Size = 2^n (where n = host bits)
Network Address: Set all host bits to 0
Broadcast Address: Set all host bits to 1
First Usable Address: Network Address + 1
Last Usable Address: Broadcast Address - 1
Next Subnet Network: Previous Broadcast Address + 1
Term
Definition
Subnet
A smaller network created by dividing a larger network using additional network bits
Subnet Mask
A 32-bit number that identifies which portion of an IP address is the network and which is the host
CIDR Notation
Method of writing prefix length using a slash followed by the number of network bits (e.g., /24)
Prefix Length
The number of bits used for the network portion of an address
Borrowed Bits
Bits taken from the host portion and added to the network portion to create subnets
Host Bits
The bits in an IP address used to identify individual devices within a network
Network Address
The first address in a subnet where all host bits are 0; identifies the subnet itself
Broadcast Address
The last address in a subnet where all host bits are 1; used to send data to all hosts
Point-to-Point Network
A network connecting exactly two devices, typically two routers
VLSM
Variable-Length Subnet Masks; technique allowing different subnet sizes within the same network
FLSM
Fixed-Length Subnet Masks; technique where all subnets use the same prefix length
IANA
Internet Assigned Numbers Authority; organization responsible for IP address allocation
2^1 = 2 2^5 = 32 2^9 = 512
2^2 = 4 2^6 = 64 2^10 = 1024
2^3 = 8 2^7 = 128 2^11 = 2048
2^4 = 16 2^8 = 256 2^12 = 4096
Position: 1st 2nd 3rd 4th 5th 6th 7th 8th
Value: 128 64 32 16 8 4 2 1
WRONG: /26 has 64 usable hosts
RIGHT: /26 has 64 - 2 = 62 usable hosts
Remember: Always subtract 2 (network and broadcast addresses)
Subnets = 2^(borrowed bits) ← NO subtraction
Hosts = 2^(host bits) - 2 ← Subtract 2
Don't subtract 2 when calculating number of subnets!
Question: "Need 8 hosts per subnet"
WRONG: Using /29 (2^3 - 2 = 6 hosts) ← Not enough!
RIGHT: Using /28 (2^4 - 2 = 14 hosts) ← Sufficient
Always verify: 2^(host bits) - 2 ≥ required hosts
/31: Formula gives 0 hosts, BUT valid for point-to-point links
/32: Identifies a single specific host (used in routing)
For exam: If asked for point-to-point prefix, use /30 unless
specifically told /31 is acceptable
WRONG: Assigning subnets in random order
RIGHT: Always start with largest subnet at beginning of address space
VLSM Order: Largest → Smallest
When using VLSM, ensure each new subnet starts AFTER the
previous subnet's broadcast address + 1
Next Network = Previous Broadcast + 1
Common mistake: Incorrectly converting between binary and decimal
192 in binary is NOT 11000001
192 in binary IS 11000000 (128 + 64 = 192)
Always double-check your conversions!
Question: What subnet does 192.168.5.57/27 belong to?
Step 1: /27 means 3 borrowed bits, 5 host bits
Step 2: Block size = 2^5 = 32
Step 3: Find which block 57 falls into
0-31, 32-63, 64-95...
57 is in the 32-63 block
Step 4: Network address = 192.168.5.32/27
Answer: 192.168.5.32/27
Question: Analyze 192.168.91.78/26
Step 1: /26 = 2 borrowed bits, 6 host bits
Step 2: Block size = 64
Step 3: 78 falls in 64-127 block
Step 4: Calculate all addresses:
Network: 192.168.91.64
First Host: 192.168.91.65
Last Host: 192.168.91.126
Broadcast: 192.168.91.127
Usable: 62 hosts
Question: Need 100 subnets with 500+ hosts from 172.30.0.0/16
For Subnets (need 100):
2^6 = 64 (not enough)
2^7 = 128 ✓ (need 7 borrowed bits)
For Hosts (need 500):
2^9 - 2 = 510 ✓ (need 9 host bits)
Check: 16 + 7 = 23 network bits
32 - 23 = 9 host bits ✓
Answer: /23
Network: 192.168.1.0/24
Requirements:
- LAN A: 110 hosts
- LAN B: 45 hosts
- LAN C: 29 hosts
- LAN D: 8 hosts
- Point-to-point: 2 hosts
Solution (largest to smallest):
1. LAN A (110): 192.168.1.0/25 (126 hosts)
2. LAN B (45): 192.168.1.128/26 (62 hosts)
3. LAN C (29): 192.168.1.192/27 (30 hosts)
4. LAN D (8): 192.168.1.224/28 (14 hosts)
5. P2P (2): 192.168.1.240/30 (2 hosts)
What does CIDR stand for and when was it introduced?
Classless Inter-Domain Routing, introduced by IETF in 1993 to replace the classful addressing system.
What is the formula for calculating the number of usable host addresses?
2^n - 2, where n = number of host bits. Subtract 2 for network and broadcast addresses.
What is the formula for calculating the number of subnets?
2^x, where x = number of borrowed bits. Do NOT subtract 2.
What is the subnet mask for /26 in dotted decimal?
255.255.255.192
How many usable hosts are in a /26 network?
62 hosts (2^6 - 2 = 64 - 2 = 62)
What is the subnet mask for /27 in dotted decimal?
255.255.255.224
How many usable hosts are in a /27 network?
30 hosts (2^5 - 2 = 32 - 2 = 30)
What is the subnet mask for /28 in dotted decimal?
255.255.255.240
How many usable hosts are in a /28 network?
14 hosts (2^4 - 2 = 16 - 2 = 14)
What is the subnet mask for /29 in dotted decimal?
255.255.255.248
How many usable hosts are in a /29 network?
6 hosts (2^3 - 2 = 8 - 2 = 6)
What is the subnet mask for /30 in dotted decimal?
255.255.255.252
How many usable hosts are in a /30 network?
2 hosts (2^2 - 2 = 4 - 2 = 2)
What prefix length is typically used for point-to-point connections?
/30 (provides exactly 2 usable addresses) or /31 (special case for point-to-point only)
What is special about a /31 prefix?
Normally provides 0 usable hosts, but for point-to-point connections, both addresses can be used (no network/broadcast needed).
What is a /32 prefix used for?
Identifies a single specific host, used in static routes or access control lists.
How do you find the network address from an IP?
Set all host bits to 0.
How do you find the broadcast address from a network address?
Set all host bits to 1.
How do you find the first usable host address?
Network address + 1
How do you find the last usable host address?
Broadcast address - 1
How do you find the next subnet's network address?
Current subnet's broadcast address + 1
What is VLSM?
Variable-Length Subnet Masks - creating subnets of different sizes to use address space more efficiently.
What is FLSM?
Fixed-Length Subnet Masks - all subnets use the same prefix length.
What is the correct order for assigning subnets using VLSM?
Largest subnet first, then proceed to smaller subnets in descending order of size.
What is the block size for /26?
64 (2^6 = 64)
What is the block size for /27?
32 (2^5 = 32)
What is the block size for /28?
16 (2^4 = 16)
How do you calculate block size from subnet mask?
256 - (last non-255 octet of subnet mask) OR 2^(host bits)
What are the bit values in an octet from left to right?
128, 64, 32, 16, 8, 4, 2, 1
If you borrow 3 bits, how many subnets can you create?
8 subnets (2^3 = 8)
If you borrow 4 bits, how many subnets can you create?
16 subnets (2^4 = 16)
What subnet does 192.168.1.78/26 belong to?
192.168.1.64/26 (Block size 64; 78 falls between 64-127)
What is the broadcast address of 192.168.1.64/26?
192.168.1.127 (64 + 64 - 1 = 127)
What prefix should you use for 45 hosts?
/26 (provides 62 usable hosts; /27 only provides 30)
What prefix should you use for 100 hosts?
/25 (provides 126 usable hosts; /26 only provides 62)
What is the subnet mask for /25 in dotted decimal?
255.255.255.128
How many usable hosts in a /25 network?
126 hosts (2^7 - 2 = 128 - 2 = 126)
What is the subnet mask for /23 in dotted decimal?
255.255.254.0
How many usable hosts in a /23 network?
510 hosts (2^9 - 2 = 512 - 2 = 510)
What is the subnet mask for /22 in dotted decimal?
255.255.252.0
What is the subnet mask for /21 in dotted decimal?
255.255.248.0
What is the subnet mask for /20 in dotted decimal?
255.255.240.0
What is the subnet mask for /19 in dotted decimal?
255.255.224.0
What is the subnet mask for /18 in dotted decimal?
255.255.192.0
What organization assigns IP addresses to companies?
IANA (Internet Assigned Numbers Authority)
Class A networks have what default prefix length?
Class B networks have what default prefix length?
Class C networks have what default prefix length?
What is the first octet range for Class A addresses?
What is the first octet range for Class B addresses?
What is the first octet range for Class C addresses?
To create 100 subnets, how many bits must you borrow?
7 bits (2^7 = 128 ≥ 100)
To create 500 subnets, how many bits must you borrow?
9 bits (2^9 = 512 ≥ 500)
If you need 1000 hosts per subnet, how many host bits do you need?
10 bits (2^10 - 2 = 1022 ≥ 1000)
What are the network addresses for 192.168.1.0/26 divided into 4 subnets?
192.168.1.0, 192.168.1.64, 192.168.1.128, 192.168.1.192
In binary, what does 192 equal?
11000000 (128 + 64 = 192)
What subnet does 172.25.217.192/21 belong to?
172.25.216.0/21
What is the broadcast address of 172.16.64.0/18?
172.16.127.255
If you divide 172.16.0.0/16 into 4 equal subnets, what prefix do you use?
/18 (borrow 2 bits: 2^2 = 4)
What are the four subnet network addresses when dividing 172.16.0.0/16 into 4 equal subnets?
172.16.0.0/18, 172.16.64.0/18, 172.16.128.0/18, 172.16.192.0/18
Why do we subtract 2 when calculating usable hosts but not when calculating subnets?
Each subnet has a network address and broadcast address that cannot be assigned to hosts. Subnets themselves are all usable - there's no "network subnet" or "broadcast subnet."
What is the purpose of subnetting?
To divide a large network into smaller, more manageable networks, improve security, reduce broadcast traffic, and use IP addresses more efficiently.
KEY FORMULAS:
• Subnets = 2^(borrowed bits)
• Hosts = 2^(host bits) - 2
• Block Size = 256 - Mask OR 2^(host bits)
• Next Subnet = Current Broadcast + 1
Subnetting Questions
www.subnettingquestions.com
www.subnetting.org
www.subnettingpractice.org
Last changed24 days ago