# Subnetting (Part 2) ## Problem You have a network topology where each segment requires **45 hosts**: ``` 45 hosts -> SW1 -> R1 <- SW3 <- 45 hosts 45 hosts -> SW2 -> R1 <- SW4 <- 45 hosts ``` You are given the network: * **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 * **Network:** 192.168.1.0/26 * **Range:** 192.168.1.0 – 192.168.1.63 * **Broadcast:** 192.168.1.63 Binary: ``` 11000000.10101000.00000001.00 000000 ``` --- ### Subnet 2 * **Network:** 192.168.1.64/26 * **Range:** 192.168.1.64 – 192.168.1.127 * **Broadcast:** 192.168.1.127 --- ### Subnet 3 * **Network:** 192.168.1.128/26 * **Range:** 192.168.1.128 – 192.168.1.191 * **Broadcast:** 192.168.1.191 --- ### Subnet 4 * **Network:** 192.168.1.192/26 * **Range:** 192.168.1.192 – 192.168.1.255 * **Broadcast:** 192.168.1.255 --- ## Quick Trick 💡 Each subnet jumps by **64**: * 0 → 64 → 128 → 192 Think of it like stepping stones across a river. Same stride, different landing spots. --- ## Subnetting Basics * **Number of subnets:** ( 2^x ) (x = borrowed bits) * **Number of hosts per subnet:** ( 2^n - 2 ) (n = host bits) --- ## Identify the Subnet ### Example 1 **Host:** 192.168.5.57/27 * /27 → block size = 32 * Subnets: 0, 32, 64, ... 57 falls between **32 and 63** → **Network:** 192.168.5.32/27 --- ### Example 2 **Host:** 192.168.29.219/29 * /29 → block size = 8 * Subnets: 0, 8, 16, ..., 216, 224 219 falls between **216 and 223** → **Network:** 192.168.29.216/29 --- ## 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 **Network:** 172.18.0.0/16 **Required subnets:** 250 * ( 2^8 = 256 ) * New prefix: **/24** --- ## Class B Reference Table | 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 | --- ## Final Review * Subnetting is about **borrowing bits** * Larger prefix = more subnets, fewer hosts * Smaller prefix = fewer subnets, more hosts