From be2333604c319e5b61d9780a5b850459c06cb2ff Mon Sep 17 00:00:00 2001 From: mrsh Date: Mon, 4 May 2026 06:24:34 +0000 Subject: [PATCH] Update 14. Subnetting (Part 2).md --- 14. Subnetting (Part 2).md | 280 ++++++++++++++++++------------------- 1 file changed, 135 insertions(+), 145 deletions(-) diff --git a/14. Subnetting (Part 2).md b/14. Subnetting (Part 2).md index 780be8a..ab4b8d8 100644 --- a/14. Subnetting (Part 2).md +++ b/14. Subnetting (Part 2).md @@ -1,201 +1,191 @@ ---- -id: 1777871422-VTLQ -aliases: - - Subnetting (Part 2) -tags: [] ---- - # Subnetting (Part 2) -## Question +## Problem -45 hosts -> SW1->+--+<-SW3<-45 hosts - |R1| -45 hosts -> SW2->+--+<-SW4<-45 hosts +You have a network topology where each segment requires **45 hosts**: -Divide the 192.168.1.0/24 network into four subnets that can accommodate -the number of hosts required. +``` +45 hosts -> SW1 -> R1 <- SW3 <- 45 hosts +45 hosts -> SW2 -> R1 <- SW4 <- 45 hosts +``` -The first subnet (Subnet 1) is 192.168.1.0/26 What are the remaining subnet +You are given the network: -Hint: Find the broadcast address of Subnet 1. The next address is the network address of -Subnet 2. Repeat the process for Subnets 3 and 4 +* **192.168.1.0/24** + +Your task is to divide it into **4 subnets**, each capable of supporting at least 45 hosts. + +--- + +## Step 1: Choose the Right Subnet Size + +To support **45 hosts**, we need: + +* ( 2^n - 2 \geq 45 ) +* ( n = 6 ) → ( 2^6 - 2 = 62 ) hosts + +So each subnet must be a **/26**. + +--- + +## Step 2: Subnet Breakdown (/26) + +Each subnet increases by **64 addresses**. + +--- ### Subnet 1 -Subnet 1: 192.168.1.0/26 -11000000.10101000.00000001.00**000000** - 192 . 168 . 1 . 0 -broadcast address: -11000000.10101000.00000001.00**111111** - 192 . 168 . 1 . 63 +* **Network:** 192.168.1.0/26 +* **Range:** 192.168.1.0 – 192.168.1.63 +* **Broadcast:** 192.168.1.63 -192.168.1.0 to 192.168.1.63 +Binary: + +``` +11000000.10101000.00000001.00 000000 +``` + +--- ### Subnet 2 -Subnet 2: 192.168.1.64/26 -11000000.10101000.00000001.01**000000** - 192 . 168 . 1 . 64 -11000000.10101000.00000001.01**111111** - 192 . 168 . 1 . 127 +* **Network:** 192.168.1.64/26 +* **Range:** 192.168.1.64 – 192.168.1.127 +* **Broadcast:** 192.168.1.127 -192.168.1.63 to 192.168.1.127 +--- ### Subnet 3 -Subnet 3: 192.168.1.128/26 -11000000.10101000.00000001.10**000000** - 192 . 168 . 1 . 128 -11000000.10101000.00000001.10**111111** - 192 . 168 . 1 . 191 +* **Network:** 192.168.1.128/26 +* **Range:** 192.168.1.128 – 192.168.1.191 +* **Broadcast:** 192.168.1.191 -192.168.1.128 to 192.168.1.191 +--- ### Subnet 4 -Subnet 4: 192.168.1.192/26 -11000000.10101000.00000001.11**000000** - 192 . 168 . 1 . 192 -11000000.10101000.00000001.11**111111** - 192 . 168 . 1 . 255 +* **Network:** 192.168.1.192/26 +* **Range:** 192.168.1.192 – 192.168.1.255 +* **Broadcast:** 192.168.1.255 -192.168.1.192 to 192.168.1.255 +--- -### Trick +## Quick Trick 💡 -By adding 64 the last bit of the network portion you can find the network address +Each subnet jumps by **64**: -## Subnetting +* 0 → 64 → 128 → 192 -11000000.10101000.00000001.0**0000000** -192.168.255.0 +Think of it like stepping stones across a river. Same stride, different landing spots. -11000000.10101000.11111111.1**0000000** -192.168.255.0 -Borrowing 1 bit = can make 2 subnets +--- -### Formulas +## Subnetting Basics -2^x = number of subnets -(x=number of 'borrowed' bits) +* **Number of subnets:** + ( 2^x ) (x = borrowed bits) -2^n-2 = number of hosts -(x=number of hosts bits) +* **Number of hosts per subnet:** + ( 2^n - 2 ) (n = host bits) -## Identify the subnet +--- -What subnet does host 192.168.5.57/27 belong to? - -11000000.10101000.00000101.00111001 -192.168.5.57 - -The borrowed bits are -11000000.10101000.00000101.**001**11001 - -to find the network address we need to change the host bits by zero - -11000000.10101000.00000101.**001**00000 -192.168.5.32 - -What subnet does host 192.168.29.219/29 belong to? - -11000000.10101000.00011101.**11011**011 -192.168.29.219 - -to find the network address we need to change the host bits by zero -11000000.10101000.00011101.**11011**000 -192.168.29.216 - -## Subnets / hosts (class C) - - -| Prefix Length | Number of subnets | Number of Hosts | -| ------------- | ----------------- | --------------- | -| /25 | 2 | 126 | -| /26 | 4 | 62 | -| /27 | 8 | 30 | -| /28 | 16 | 14 | -| /29 | 32 | 6 | -| /30 | 64 | 2 | -| /31 | 128 | 0 (2) | -| /32 | 156 | 0 (1) | - - -## Subenetting Class B - -The process of subnetting Class A, Class B and Class C networks is : -Exactly the same ! +## Identify the Subnet ### Example 1 -You have been given the 172.16.0.0/16 network. You are asked to create 80 -subnets for your company's various LANs, What prefix length should you use ? +**Host:** 192.168.5.57/27 -172.16.0.0/16 +* /27 → block size = 32 +* Subnets: 0, 32, 64, ... -10101100.00010000.00000000.00000000 - 172 . 16 . 0 . 0 +57 falls between **32 and 63** -We have to borrow 7 bits = 128 subnets +→ **Network:** 192.168.5.32/27 -10101100.00010000.**0000000**0.00000000 - 172 . 16 . 0 . 0 +--- ### Example 2 -You have been given the 172.22.0.0/16 network. You are asked to create 500 -subnets for your company's various LANs, What prefix length should you use ? +**Host:** 192.168.29.219/29 -172.22.0.0/16 +* /29 → block size = 8 +* Subnets: 0, 8, 16, ..., 216, 224 -10101100.00010000.00000000.00000000 - 172 . 22 . 0 . 0 +219 falls between **216 and 223** -We have to borrow 9 bits = 512 subnets = /25 +→ **Network:** 192.168.29.216/29 -10101100.00010000.**00000000.0**0000000 - 172 . 22 . 0 . 0 +--- + +## Class C Reference Table + +| Prefix | Subnets | Hosts | +| ------ | ------- | ----- | +| /25 | 2 | 126 | +| /26 | 4 | 62 | +| /27 | 8 | 30 | +| /28 | 16 | 14 | +| /29 | 32 | 6 | +| /30 | 64 | 2 | + +--- + +## Subnetting Class B Networks + +The method is exactly the same. Only the starting mask changes. + +--- + +### Example 1 + +**Network:** 172.16.0.0/16 +**Required subnets:** 80 + +* ( 2^7 = 128 ) → enough +* New prefix: **/23** + +--- + +### Example 2 + +**Network:** 172.22.0.0/16 +**Required subnets:** 500 + +* ( 2^9 = 512 ) +* New prefix: **/25** + +--- ### Example 3 -You have given the 172.18.0.0/16 network. Your company requires 250 subnets with the -same number of hosts per subnet. What prefix length should you use +**Network:** 172.18.0.0/16 +**Required subnets:** 250 -172.18.0.0 +* ( 2^8 = 256 ) +* New prefix: **/24** -10101100.00010000.00000000.00000000 - 172 . 18 . 0 . 0 +--- -We have to borrow 8 bits = 256 subnets = /24 +## Class B Reference Table -10101100.00010000.**00000000**.00000000 - 172 . 18 . 0 . 0 +| Prefix | Subnets | Hosts | +| ------ | ------- | ----- | +| /17 | 2 | 32766 | +| /18 | 4 | 16382 | +| /19 | 8 | 8190 | +| /20 | 16 | 4094 | +| /21 | 32 | 2046 | +| /22 | 64 | 1022 | +| /23 | 128 | 510 | +| /24 | 256 | 254 | -## Subnets / hosts (class B) +--- +## Final Review -| Prefix Length | Number of subnets | Number of Hosts | -| ------------- | ----------------- | --------------- | -| /17 | 2 | 32766 | -| /18 | 4 | 16382 | -| /19 | 8 | 8190 | -| /20 | 16 | 4094 | -| /21 | 32 | 2044 | -| /22 | 64 | 1022 | -| /23 | 128 | 510 | -| /24 | 256 | 254 | -| /25 | 2 | 126 | -| /26 | 4 | 62 | -| /27 | 8 | 30 | -| /28 | 16 | 14 | -| /29 | 32 | 6 | -| /30 | 64 | 2 | -| /31 | 128 | 0 (2) | -| /32 | 156 | 0 (1) | - - -## Review - -- Subnetting practice questions (class C networks) -- Subnetting Class B networks +* Subnetting is about **borrowing bits** +* Larger prefix = more subnets, fewer hosts +* Smaller prefix = fewer subnets, more hosts \ No newline at end of file