Course: COMP347 Computer Networks (Revision 10) | Textbook: Kurose & Ross, Computer Networking: A Top‑Down Approach (9th ed.)
Upon completion of this tutorial, students should be able to:
Subnetting and CIDR are fundamental techniques for efficiently managing IP address space. While the Internet initially used classful addressing, the rapid growth of networks made it clear that a more flexible approach was needed. Classless Inter‑Domain Routing (CIDR) was introduced to replace classful boundaries with variable‑length prefixes, enabling efficient address allocation, route aggregation, and the creation of subnets.
This tutorial covers the mechanics of subnetting, including the binary math behind masks, network and broadcast addresses, and host ranges. It then moves to Variable‑Length Subnet Masking (VLSM), which allows different subnets to have different sizes, maximizing address utilization. Address aggregation (route summarization) is explained, showing how CIDR reduces routing table size. Practical network design scenarios are provided, along with advanced topics like IPv6 subnetting and automated address allocation.
CIDR was introduced in 1993 to address the limitations of classful addressing. It abandons the fixed class boundaries (A, B, C) and uses a variable‑length prefix to denote the network portion. The prefix length is specified using slash notation (e.g., /24). This allows networks to be allocated in blocks that exactly fit their needs, reducing waste and enabling route aggregation.
Key benefits of CIDR:
Subnetting is the process of dividing a larger network into smaller subnetworks (subnets). Each subnet has its own network address and range of host addresses. The division is done by extending the network prefix using a subnet mask.
Key concepts:
Given a prefix length /n, the subnet mask has n ones followed by (32‑n) zeros. The number of host addresses = 2^(32‑n). Usable hosts = 2^(32‑n) - 2 (network and broadcast).
Subnet masks can be expressed in dotted‑decimal (e.g., 255.255.255.0) or prefix length (/24). Common masks:
| Prefix | Mask | Hosts (usable) |
|---|---|---|
| /8 | 255.0.0.0 | 16,777,214 |
| /16 | 255.255.0.0 | 65,534 |
| /24 | 255.255.255.0 | 254 |
| /25 | 255.255.255.128 | 126 |
| /26 | 255.255.255.192 | 62 |
| /27 | 255.255.255.224 | 30 |
| /28 | 255.255.255.240 | 14 |
| /29 | 255.255.255.248 | 6 |
| /30 | 255.255.255.252 | 2 |
VLSM allows subnets within a network to have different prefix lengths, enabling more efficient use of address space. For example, a /24 network can be divided into subnets of varying sizes: one /25 (128 addresses), two /26 (64 each), etc., to match the needs of different segments.
VLSM advantages: Minimizes address waste, allows hierarchical addressing, and supports flexible network design.
VLSM rules: Subnets must not overlap; the addresses must be assigned in order from largest to smallest to avoid fragmentation.
Route aggregation is the process of combining multiple contiguous prefixes into a single, less specific prefix. This reduces the number of entries in routing tables and speeds up forwarding.
Example: Prefixes 192.168.0.0/24, 192.168.1.0/24, 192.168.2.0/24, 192.168.3.0/24 can be summarized as 192.168.0.0/22 (since the first 22 bits are common).
Condition for aggregation: The prefixes must be contiguous and align on a boundary that matches the aggregated prefix length.
When designing a subnetting scheme, follow these steps:
Consider future growth and leave some spare addresses.
Subnetting requires proficiency in binary operations:
Example: IP = 192.168.1.45, mask = 255.255.255.0 (/24). Network = 192.168.1.0, broadcast = 192.168.1.255.
Supernetting is similar to aggregation but specifically refers to combining multiple classful networks into a larger block. However, with CIDR, the term is often used interchangeably with route summarization.
In ISPs, aggregation is critical to keep global routing tables small. For example, an ISP with many customers may advertise a single prefix covering all its customer networks.
Hierarchical addressing: The Internet's address hierarchy follows a tree structure: IANA → RIRs → ISPs → organizations. Subnetting within an organization extends this hierarchy.
IPv6 subnetting: IPv6 uses a 128‑bit address, but subnetting is similar. The typical subnet size is /64, which provides 2^64 host addresses. VLSM is also supported. Hierarchical allocation is even more important in IPv6 due to the massive address space.
Automation: Tools like DHCP and IPAM (IP Address Management) automate subnet allocation and reduce errors. Modern networks often use SDN controllers to programmatically manage addressing.
Q1. What is the primary purpose of CIDR?
B)
Q2. A subnet mask of 255.255.255.240 has what prefix length?
C) /28 (240 = 11110000, so 24+4=28)
Q3. How many usable host addresses are there in a /27 subnet?
A) 30 (2^(32‑27) = 2^5 = 32; minus 2 = 30)
Q4. Which of the following is the broadcast address for network 192.168.10.0/26?
A) 192.168.10.63 (host bits all 1: 00‑63)
Q5. What is the network address for IP 10.0.5.67 with subnet mask 255.255.255.248?
A) 10.0.5.64 (248 = /29, block size 8; 67 is in 64‑71 range)
Q6. VLSM allows:
A)
Q7. Which of the following is a valid summary route for 172.16.0.0/24, 172.16.1.0/24, 172.16.2.0/24, 172.16.3.0/24?
A) /22 (covers 172.16.0.0 – 172.16.3.255)
Q8. If you need 70 subnets and each subnet must support at least 500 hosts, what is the minimum prefix length for the overall address block? Assume you can use a private address range.
B) /17 (need 2^7=128 subnets with 2^9=512 hosts; total 2^(16)? Actually, need bits for subnets and hosts. Let's compute: required hosts = 500 → 9 host bits (2^9=512). Required subnets = 70 → 7 subnet bits (2^7=128). Total bits = 16 (if starting from /16?) Wait, more systematically: We need a block that can be subdivided. If we start from a /16, we have 16 bits left. We need 7 bits for subnets and 9 for hosts = 16 bits. So /16 is sufficient. But the question asks for minimum prefix length for the overall block, which would be the smallest prefix (largest block) that can contain that many subnets and hosts. Actually, the block prefix length is fixed; we can choose a /16 block (e.g., 172.16.0.0/16) and then subnet it. So the answer is /16. But options include /17 which gives 15 bits, insufficient. So correct is not listed. Let's re-evaluate: Need 70 subnets → 7 bits (128). Need 500 hosts → 9 bits (512). Total bits needed = 7+9=16. So a /16 block has 16 bits for host/subnet. So a /16 block is sufficient. So the prefix length should be ≤16. Among options, /16 is not there? Actually options are /16,/17,/18,/19. So answer is A) /16. But we need to ensure we can allocate 70 subnets with VLSM; with a /16 we have 16 bits to split, 7 for subnets and 9 for hosts, total 16. Yes. So A) /16.
Q9. Which of the following is the wildcard mask (inverse mask) for a /24 subnet?
B) 0.0.0.255 (wildcard mask = 255.255.255.255 XOR mask)
Q10. Route aggregation is beneficial because it:
B)
Q11. The network address of 10.1.2.3 with mask 255.255.255.192 is:
A) 10.1.2.0 (since 3 < 64, block starts at 0)
Q12. Which subnet mask would you use for a subnet with 12 hosts?
A) /28 (240) gives 14 usable hosts (16‑2=14), which fits 12.
Q13. What is the maximum number of subnets that can be created from a /24 network if each subnet must have at least 10 usable hosts?
B) 16 (need host bits: 10 hosts → 4 bits (16‑2=14); so prefix length = 24+4=28? Wait: /24 has 8 host bits. To have at least 10 usable hosts, we need at least 4 host bits (2^4‑2=14). So we borrow 4 bits for subnets, leaving 4 host bits → 16 subnets of size 16 (14 usable). So 16 subnets.
Q14. Which of the following is an example of supernetting?
A) Supernetting is aggregation of prefixes into a larger prefix.
Q15. In VLSM, which subnets should be allocated first?
B) The largest subnets to avoid fragmentation and ensure contiguous allocation.
Q16. The broadcast address for 10.0.0.0/8 is:
A) 10.255.255.255
Q17. How many bits are borrowed for subnetting if the mask changes from /24 to /27?
C) 3 (27‑24=3)
Q18. Which of the following IP addresses is the network address for 192.168.5.200/27?
A) 192.168.5.192 (blocks of 32, 192‑223)
Q19. A /25 subnet has how many total addresses?
A) 128 (2^(32‑25)=2^7=128)
Q20. What is the valid host range for network 172.16.8.0/21?
A) 172.16.8.1 – 172.16.15.254 (block of 2048 addresses, network .8.0, broadcast .15.255)
Q21. Which of the following is a private address range as per RFC 1918?
D) Both B and C (also 172.16.0.0/12)
Q22. What is the prefix length for a mask of 255.255.255.252?
A) /30
Q23. In CIDR notation, 10.0.0.0/16 represents:
B) A network with 65,536 addresses (2^16)
Q24. If you have a /20 network, how many /24 subnets can you create?
C) 16 (20‑24=4 bits, 2^4=16)
Q25. Which of the following is the correct wildcard mask for a /26 subnet?
A) 0.0.0.63 (63 = 2^(32‑26)‑1 = 2^6‑1 = 63)
Q26. What is the purpose of the subnet mask in an IP address?
A)
Q27. Which of the following is not a valid subnet mask?
D) 255.255.255.250 (binary: 11111010, not contiguous 1s)
Q28. A company has 2000 employees and plans to give each employee a unique IP address. What is the minimum prefix length needed if they use a single subnet?
B) /21 (2^(32‑21)=2^11=2048 addresses, enough for 2000 hosts; /20 gives 4096, which is also sufficient but larger, but we need minimum. Actually /21 gives 2048, usable 2046, enough. So /21 is the smallest that can hold 2000 hosts. Check: /21 has 11 host bits = 2048 addresses. So answer B.
Q29. Route summarization is also known as:
A) Supernetting
Q30. What is the broadcast address for subnet 192.168.4.0/22?
A) 192.168.7.255 (block size 1024, covers 4.0 to 7.255)
Q31. Which of the following prefixes is the most specific?
D) /27 (longest prefix is most specific)
Q32. The address 169.254.1.1 is used for:
B) Link‑local (APIPA)
Q33. Explain how CIDR notation is used to represent both the address and the mask.
CIDR notation uses the format address/prefix-length, where the prefix length indicates the number of contiguous 1s in the subnet mask. For example, 192.168.1.0/24 means the network portion is the first 24 bits, and the mask is 255.255.255.0. This is concise and unambiguous.
Q34. Why is it important to subtract 2 from the total number of addresses in a subnet to get usable hosts?
The all‑zero address is the network address, and the all‑one address is the broadcast address. These cannot be assigned to individual hosts. Therefore, the number of usable host addresses is 2^(host bits) - 2.
Q35. Describe the concept of route aggregation and its impact on routing table size.
Route aggregation combines multiple contiguous prefixes into a single, less specific prefix. This reduces the number of entries in routing tables, which speeds up forwarding and reduces memory requirements. It is a key benefit of CIDR.
Q36. What is VLSM and why is it used?
Variable‑Length Subnet Masking allows subnets within a network to have different sizes, using different prefix lengths. It maximizes address utilization by allocating smaller subnets to segments with fewer hosts and larger subnets to segments with more hosts, reducing waste.
Q37. Explain how to calculate the network address from a given IP and subnet mask.
Convert both the IP address and the subnet mask to binary, then perform a bitwise AND operation. The result is the network address. For example, IP 192.168.1.45 (11000000.10101000.00000001.00101101) AND mask 255.255.255.0 (11111111.11111111.11111111.00000000) gives 192.168.1.0.
Q38. A company has been allocated the address block 172.16.0.0/16. They need to create subnets for 5 departments with the following host requirements: Engineering: 500 hosts, Marketing: 200 hosts, HR: 50 hosts, IT: 20 hosts, Admin: 10 hosts. Design a VLSM scheme that meets these requirements with minimal waste.
Use VLSM: Start with largest to smallest. Engineering: 500 hosts → need 9 host bits (2^9=512, usable 510) → /23 (since 32‑23=9). So assign 172.16.0.0/23 (addresses .0.0 – .1.255). Marketing: 200 hosts → need 8 host bits (2^8=256, usable 254) → /24. Use next block: 172.16.2.0/24. HR: 50 hosts → need 6 host bits (2^6=64, usable 62) → /26. Use 172.16.3.0/26 (covers .3.0‑.3.63). IT: 20 hosts → need 5 host bits (32, usable 30) → /27. Use 172.16.3.64/27 (covers .3.64‑.3.95). Admin: 10 hosts → need 4 host bits (16, usable 14) → /28. Use 172.16.3.96/28 (covers .3.96‑.3.111). Check non‑overlapping: all within 172.16.0.0/16.
Q39. Given the prefix 192.168.0.0/22, what are the network address, broadcast address, and the range of usable host addresses for the first subnet if we subnet it into /24s?
192.168.0.0/22 covers 192.168.0.0 – 192.168.3.255. Subnetting into /24s gives four subnets: 192.168.0.0/24, 192.168.1.0/24, 192.168.2.0/24, 192.168.3.0/24. For the first subnet: network 192.168.0.0, broadcast 192.168.0.255, usable hosts 192.168.0.1 – 192.168.0.254.
Q40. A router receives a packet with destination 10.5.2.100. The routing table has entries: 10.0.0.0/8 via A, 10.5.0.0/16 via B, 10.5.2.0/24 via C, and default via D. Which route will be chosen and why?
The longest match is 10.5.2.0/24 (24 bits), so the packet will be sent via C. Longest‑prefix matching ensures the most specific route is used.
Q41. Explain the difference between fixed‑length subnetting and VLSM, and give a scenario where VLSM is more efficient.
Fixed‑length subnetting uses the same prefix length for all subnets, which wastes addresses if subnets have varying host counts. VLSM allows different sizes, reducing waste. For example, an organization with 1000 hosts in one department and 10 in another would waste many addresses with fixed /22, but VLSM can allocate a /22 to the large department and a /28 to the small one.
Q42. What is the purpose of the default route (0.0.0.0/0) in a forwarding table, and how does it relate to subnetting?
The default route is used when no other prefix matches. It is the least specific route and is often used to send packets to an upstream router for destinations outside the local network. In subnetting, the default route handles traffic to networks that are not explicitly in the routing table, simplifying configuration.
Q43. A network administrator wants to summarize the following routes: 192.168.16.0/24, 192.168.17.0/24, 192.168.18.0/24, 192.168.19.0/24. What is the summarized route?
These are four contiguous /24s from 16 to 19, which can be summarized as 192.168.16.0/22 (since /22 covers 16.0 – 19.255).
Q44. Design a subnetting plan for a small office that has 10 employees, but expects to grow to 50 employees in the next year. The office uses a single network and wants to allocate addresses efficiently. What prefix would you recommend?
Plan for future growth: 50 employees → need at least 50 usable addresses, so need at least 64 addresses (2^6=64, minus 2 = 62). Use a /26 subnet (64 addresses). If they have a block, they can allocate a /26 and still have room for expansion. Better to use a /24 if available, but minimum is /26 for 50 hosts.
Q45. What is the difference between a subnet mask and a wildcard mask?
A subnet mask has 1s in the network portion and 0s in the host portion. A wildcard mask is the inverse: 0s in the network portion and 1s in the host portion (i.e., 255.255.255.255 XOR subnet mask). Wildcard masks are used in ACLs and OSPF to specify ranges.
Q46. Calculate the number of subnets and hosts per subnet for a /19 network when subnetted into /23 subnets.
From /19 to /23, we borrow 4 bits (23‑19=4). Number of subnets = 2^4 = 16. Host bits = 32‑23 = 9, so hosts per subnet = 2^9‑2 = 510.
Q47. A network has the address 10.10.0.0/16. It needs to be divided into subnets, each with at most 1000 hosts. What is the maximum number of subnets that can be created?
Need host bits for 1000 hosts: 2^10 = 1024, so 10 host bits (usable 1022). So prefix length = 16+? Actually, from /16, we have 16 bits for subnet+host. To have 10 host bits, we allocate 6 bits for subnets (16‑6=10). So number of subnets = 2^6 = 64.
Q48. Explain the concept of "prefix aggregation" and how it helps ISPs manage their routing tables.
Prefix aggregation is the process of combining multiple routes into a single, less specific prefix. ISPs aggregate the prefixes of their customers into a few larger prefixes, reducing the number of routes they advertise to the global Internet. This keeps global BGP tables manageable and improves scalability.
Q49. What is the role of a subnet mask in determining whether a destination is on the same local network?
A host uses its own subnet mask and destination IP to compute the network address of the destination. If the destination's network address matches the host's network address, they are on the same subnet; otherwise, the packet must be sent to a router.
Q50. Given the address 192.168.10.5/25, what is the network address, broadcast address, and the number of usable hosts?
/25 means mask 255.255.255.128. Block size = 128. Network: 192.168.10.0 (since 5 < 128). Broadcast: 192.168.10.127. Usable hosts: 192.168.10.1 – 192.168.10.126 (126 hosts).
Convert the following subnet masks to prefix length: a) 255.255.255.0 b) 255.255.248.0 c) 255.255.255.240 d) 255.255.255.252
a) /24 b) /21 (255.255.248.0 = 11111111.11111111.11111000.00000000 → 21 ones) c) /28 d) /30
For each of the following IP address/mask pairs, determine the network address, broadcast address, and usable host range: a) 10.0.5.17/255.255.255.240 b) 172.16.10.25/255.255.255.192 c) 192.168.1.100/255.255.255.224
a) /28, block 16: network 10.0.5.16, broadcast 10.0.5.31, hosts 10.0.5.17‑10.0.5.30.
b) /26, block 64: network 172.16.10.0, broadcast 172.16.10.63, hosts 1‑62.
c) /27, block 32: network 192.168.1.96, broadcast 192.168.1.127, hosts 97‑126.
Given the network 192.168.5.0/24, design a VLSM scheme for the following host requirements: Subnet A: 60 hosts, Subnet B: 30 hosts, Subnet C: 10 hosts, Subnet D: 2 hosts (for a point‑to‑point link).
Order: A (60) → /26 (62 usable) → 192.168.5.0/26 (0‑63). B (30) → /27 (30 usable) → 192.168.5.64/27 (64‑95). C (10) → /28 (14 usable) → 192.168.5.96/28 (96‑111). D (2) → /30 (2 usable) → 192.168.5.112/30 (112‑115). All within /24.
Perform route aggregation for the following prefixes: 10.1.0.0/24, 10.1.1.0/24, 10.1.2.0/24, 10.1.3.0/24. What is the summarized route?
These are 10.1.0.0 to 10.1.3.255, which is /22 (since 4 blocks of /24). Summarized route: 10.1.0.0/22.
How many subnets and hosts per subnet are there in a /19 network when subnetted into /24? What is the block size?
From /19 to /24, borrow 5 bits (24‑19=5) → 2^5 = 32 subnets. Host bits = 32‑24 = 8 → 2^8‑2 = 254 hosts per subnet. Block size = 256.
An organization has the address block 172.20.0.0/16. They want to create 100 subnets, each with at least 500 usable hosts. What prefix length should they use for the subnets?
Need 500 hosts → 9 host bits (2^9=512, usable 510). Need 100 subnets → 7 subnet bits (2^7=128). Total bits needed = 7+9=16. So from /16, we have 16 bits to split. We need at least 7 bits for subnets, so we can use a /23 prefix (since 16‑? Actually, starting from /16, we have 16 bits for subnet+host. We need 7 bits for subnet, leaving 9 bits for hosts → prefix length = 16+7 = /23. So /23 subnets will give 128 subnets of 510 hosts each. So use /23.
What is the wildcard mask for a /22 subnet?
Mask for /22 is 255.255.252.0. Wildcard = 255.255.255.255 XOR 255.255.252.0 = 0.0.3.255.
Given the prefix 10.0.0.0/8, how many /24 subnets can be created, and what is the total number of usable addresses across all subnets?
From /8 to /24, borrow 16 bits (24‑8=16) → 2^16 = 65,536 subnets. Each /24 has 254 usable hosts. Total usable hosts = 65,536 * 254 = 16,646,144 (which is (2^24‑2) = 16,777,214? Actually 2^24 = 16,777,216 total addresses, minus 2 per subnet? The total usable is the entire /8 block minus 2 for each subnet? But the sum of all usable in all subnets equals total addresses in /8 minus 2 * number of subnets? Wait: /8 has 2^24 = 16,777,216 addresses. Each /24 subnet has a network and broadcast address, so each subnet loses 2 addresses. Total subnets = 65,536, so total lost = 131,072. Usable = 16,777,216 - 131,072 = 16,646,144.
A router has the following routing table: 192.168.0.0/16 via A, 192.168.5.0/24 via B, 192.168.5.128/25 via C, 0.0.0.0/0 via D. What is the next hop for destination 192.168.5.200?
192.168.5.200 matches /16, /24, and /25 (since 200 ≥ 128). Longest is /25, so via C.
Design a subnetting scheme for the network 10.10.0.0/16 that supports 6 subnets with the following host requirements: Subnet1: 2000, Subnet2: 1000, Subnet3: 500, Subnet4: 200, Subnet5: 100, Subnet6: 50. Use VLSM.
Largest first: Subnet1 2000 → need 11 host bits (2^11=2048) → /21 (16+5? Actually /16 + 5 = /21) because 16-21=5 borrowed. So assign 10.10.0.0/21 (covers 0.0‑7.255). Subnet2 1000 → need 10 host bits (1024) → /22. Next: 10.10.8.0/22 (8.0‑11.255). Subnet3 500 → need 9 host bits (512) → /23. Next: 10.10.12.0/23 (12.0‑13.255). Subnet4 200 → need 8 host bits (256) → /24. Next: 10.10.14.0/24 (14.0‑14.255). Subnet5 100 → need 7 host bits (128) → /25. Next: 10.10.15.0/25 (15.0‑15.127). Subnet6 50 → need 6 host bits (64) → /26. Next: 10.10.15.128/26 (15.128‑15.191). All within /16.
What is the effect of changing the subnet mask from /24 to /28 on the number of subnets and hosts per subnet?
Increasing prefix length from /24 to /28 (borrowing 4 bits) increases number of subnets by factor of 2^4 = 16, and decreases host bits by 4, so hosts per subnet = 2^(32‑28)‑2 = 14 (from 254). So more subnets, fewer hosts each.
A company has acquired the address block 192.168.16.0/20. They want to divide it into four equal‑sized subnets. What is the prefix length and address range for each?
Four subnets need 2 bits (2^2=4). /20 + 2 = /22. Each /22 has 1024 addresses. Subnet1: 192.168.16.0/22 (16.0‑19.255). Subnet2: 192.168.20.0/22 (20.0‑23.255). Subnet3: 192.168.24.0/22 (24.0‑27.255). Subnet4: 192.168.28.0/22 (28.0‑31.255).
Explain how you would determine if two IP addresses are on the same subnet given their addresses and subnet mask.
Compute the network address for each by ANDing with the mask. If the network addresses are identical, they are on the same subnet. Otherwise, they are not.
What is the maximum number of hosts that can be on a network with a /27 subnet mask?
Host bits = 32‑27 = 5 → 2^5 = 32 total addresses, usable = 30 hosts.
A network has the address 172.16.0.0/12. How many bits are in the network portion, and how many host bits? How many total addresses?
Network bits = 12, host bits = 20. Total addresses = 2^20 = 1,048,576.
Research the history of CIDR and its impact on Internet routing. Write a 500‑word summary.
CIDR was introduced in 1993 (RFC 1519) to replace classful addressing. It enabled variable‑length prefixes, route aggregation, and slowed the growth of routing tables. It was essential for the Internet's scalability. The transition from classful to CIDR required changes to routing protocols (e.g., BGP-4) and led to the development of supernetting. Today, CIDR is fundamental to IP addressing.
Design a detailed VLSM scheme for a medium‑sized enterprise with the following address block: 10.0.0.0/8. Departments: R&D (4000 hosts), Sales (2000), Marketing (800), Engineering (3000), IT (200), Admin (100), and 10 point‑to‑point links each requiring 2 hosts. Minimize waste.
Assign largest first: R&D 4000 → /20 (4094 usable). Sales 2000 → /21 (2046). Engineering 3000 → /20? Actually 3000 needs 12 host bits (4096) → /20. But we can use /20 for both R&D and Engineering? We have a large block; we can allocate: R&D: 10.0.0.0/20 (0.0‑15.255). Engineering: 10.0.16.0/20 (16.0‑31.255). Sales: 10.0.32.0/21 (32.0‑39.255). Marketing: 800 → needs 10 host bits (1024) → /22. Use 10.0.40.0/22 (40.0‑43.255). IT: 200 → /24 (254). Use 10.0.44.0/24. Admin: 100 → /25 (126). Use 10.0.45.0/25. Point‑to‑point links: each /30 (2 hosts). Use 10.0.45.128/30, 10.0.45.132/30, ... up to 10 links. All within /8.
Explain the difference between subnetting and supernetting. Provide examples of when each is used.
Subnetting divides a network into smaller subnetworks (e.g., splitting a /16 into /24s). Supernetting combines multiple networks into a larger block (e.g., merging /24s into a /22). Subnetting is used within an organization to manage address space; supernetting is used by ISPs to reduce routing table size.
Calculate the number of IP addresses, usable hosts, and wildcard mask for the following prefixes: a) /19 b) /23 c) /28.
a) /19: 2^13=8192 addresses, usable 8190, wildcard = 0.0.31.255.
b) /23: 2^9=512 addresses, usable 510, wildcard = 0.0.1.255.
c) /28: 2^4=16 addresses, usable 14, wildcard = 0.0.0.15.
Explain the concept of Variable‑Length Subnet Masking and its advantages over fixed‑length subnetting. Provide a real‑world example where VLSM is necessary.
VLSM allows subnets of different sizes within the same network. It minimizes waste. Example: An organization with headquarters (1000 users), branch (100 users), and a remote office (10 users) can use a /22, /25, and /28 respectively, all within a /16 block. Fixed‑length would waste many addresses.
Given the following routes: 192.168.8.0/24, 192.168.9.0/24, 192.168.10.0/24, 192.168.11.0/24, 192.168.12.0/24, 192.168.13.0/24, 192.168.14.0/24, 192.168.15.0/24. Find the best summary route.
These cover 192.168.8.0 to 192.168.15.255, which is 8 blocks of /24. The summary is 192.168.8.0/21 (since 8.0 to 15.255 = /21).
Describe the role of subnetting in network security and traffic segmentation.
Subnetting allows network segmentation, which can improve security by isolating different departments or functions. It also enables traffic filtering at subnet boundaries, reduces broadcast traffic, and improves performance by containing local traffic.
An ISP has been allocated 200.0.0.0/8. They need to assign blocks to 500 customers, each requiring at least 256 addresses. What is the minimum prefix length that can be given to each customer, and how many customers can be supported?
Each customer needs 256 addresses → /24 (since 2^8=256). From /8 to /24, borrow 16 bits → 2^16 = 65,536 subnets. So they can support 65,536 customers, far more than 500. So each customer gets a /24.
Explain the relationship between subnet masks and prefix length. How would you convert a prefix length to a subnet mask?
Prefix length is the number of 1s in the mask. To convert, write that many 1s followed by zeros to make 32 bits, then convert to dotted‑decimal. For example, /20 → 11111111.11111111.11110000.00000000 → 255.255.240.0.
What are the limitations of using a /31 subnet for point‑to‑point links?
A /31 has only 2 addresses (2^1=2) and no broadcast address. It is used for point‑to‑point links to save addresses, as defined in RFC 3021. It works because on a point‑to‑point link, there is no need for a broadcast address, and the two hosts can be assigned the two addresses. This is more efficient than a /30.
Compare and contrast IPv4 subnetting and IPv6 subnetting. What are the key differences in prefix lengths and addressing?
IPv6 uses 128‑bit addresses, with typical subnet size /64 (for hosts). Subnetting in IPv6 is similar but uses larger blocks. The hierarchical structure is more important in IPv6 due to the huge address space. IPv6 also uses EUI‑64 for host portion generation. Subnetting in IPv6 often uses /48 for organizations, /64 for subnets, and /128 for host addresses.
Given the address block 10.0.0.0/8, design a subnetting scheme that supports 2000 subnets, each with at least 1000 hosts. What prefix length should you use for the subnets?
Need 1000 hosts → 10 host bits (1024). Need 2000 subnets → 11 subnet bits (2048). Total bits = 21. Since we have a /8 block, we need to borrow 21 bits? Actually, from /8, we have 24 bits left. We need 11 bits for subnets and 10 for hosts, total 21, so prefix length = 8+11 = /19? Wait: The subnet mask length would be 8 (original) + bits borrowed for subnets. We need 11 bits for subnets, so prefix = 8+11 = /19. That leaves 32‑19 = 13 host bits, which is more than 10, so it's fine. But we want exactly 10 host bits for efficiency; we could use a /22? Let's compute: If we use /22, prefix = 22, host bits = 10, subnet bits = 22‑8 = 14, giving 2^14=16,384 subnets. That is more than 2000. So /22 works. But we need at least 1000 hosts, /22 gives 1022 hosts. So answer: /22.
Explain the process of determining the number of subnets and hosts per subnet when given a network address and a new subnet mask.
Given original prefix length P and new prefix length N (N > P). Number of subnets = 2^(N‑P). Host bits = 32‑N, so hosts per subnet = 2^(32‑N)‑2.
A company has several offices connected via WAN links. They want to use private addressing and need to design a network that can scale to 500 subnets. They have been allocated 172.16.0.0/12. What is the maximum number of hosts per subnet if they use /24 subnets?
If they use /24 subnets, each has 254 hosts. From /12 to /24, number of subnets = 2^(24‑12)=2^12=4096 subnets, more than 500. So /24 is fine. Each /24 has 254 hosts.
What is the significance of the all‑zero and all‑one addresses in a subnet, and why are they not assignable to hosts?
The all‑zero address is the network address, used to identify the subnet. The all‑one address is the broadcast address, used to send a packet to all hosts on the subnet. They are reserved and cannot be assigned to individual interfaces because they are used for special functions in IP networking.
This tutorial has provided an in‑depth exploration of subnetting, CIDR, and address aggregation. Key takeaways:
In the next tutorial, we will cover IPv4 fragmentation and MTU considerations, which complement the addressing concepts discussed here.