Buffl

Subentting Practical Questions

as
by abdullah S.

You have been given the 172.30.0.0/16 network. Your companyrequires 100 subnets with at least 500 hosts per subnet. What prefixlength should you use?

Finding the Right Prefix Length for 172.30.0.0/16


What We Have

Original Network: 172.30.0.0/16


/16 means:

- Network bits: 16

- Host bits: 32 - 16 = 16

- Total addresses: 2^16 = 65,536


What We Need

Requirements:

✓ At least 100 subnets

✓ At least 500 hosts per subnet


Step 1: Find Bits Needed for Subnets

How many bits to create at least 100 subnets?

Bits Borrowed │ Formula │ Subnets Created │ Enough?

──────────────┼─────────┼─────────────────┼─────────

1 │ 2^1 │ 2 │ ❌

2 │ 2^2 │ 4 │ ❌

3 │ 2^3 │ 8 │ ❌

4 │ 2^4 │ 16 │ ❌

5 │ 2^5 │ 32 │ ❌

6 │ 2^6 │ 64 │ ❌

7 │ 2^7 │ 128 │ ✅ (≥100)


Answer: We need to borrow at least 7 bits for subnets


Step 2: Find Bits Needed for Hosts

How many bits to have at least 500 hosts?

Host Bits │ Formula │ Total Addresses │ Usable Hosts │ Enough?

──────────┼─────────┼─────────────────┼──────────────┼─────────

7 │ 2^7 │ 128 │ 128-2=126 │ ❌

8 │ 2^8 │ 256 │ 256-2=254 │ ❌

9 │ 2^9 │ 512 │ 512-2=510 │ ✅ (≥500)

Answer: We need at least 9 bits for hosts


Step 3: Calculate the New Prefix

We have 16 host bits in /16. Let's split them:

Original host bits: 16

Needed for subnets: 7 bits (gives 128 subnets)

Needed for hosts: 9 bits (gives 510 hosts)

──

Total: 16 bits ✅ Perfect fit!


New prefix calculation:

Original prefix: /16

Bits borrowed: + 7

────

New prefix: /23



Step 4: Verify Our Answer

Check /23:

┌────────────────────────────────────────────────────────────┐

│ VERIFICATION │

├────────────────────────────────────────────────────────────┤

│ │

│ Prefix: /23 │

│ │

│ Network bits: 23 │

│ Host bits: 32 - 23 = 9 │

│ │

│ ┌─────────────────────────────────────────────────────┐ │

│ │ SUBNETS: │ │

│ │ Bits borrowed from /16 = 23 - 16 = 7 bits │ │

│ │ Number of subnets = 2^7 = 128 subnets │ │

│ │ Need 100 → Have 128 ✅ │ │

│ └─────────────────────────────────────────────────────┘ │

│ │

│ ┌─────────────────────────────────────────────────────┐ │

│ │ HOSTS: │ │

│ │ Host bits = 9 │ │

│ │ Addresses per subnet = 2^9 = 512 │ │

│ │ Usable hosts = 512 - 2 = 510 │ │

│ │ Need 500 → Have 510 ✅ │ │

│ └─────────────────────────────────────────────────────┘ │

│ │

└────────────────────────────────────────────────────────────┘


Step 5: Why Not Other Prefixes?

What about /22?

/22:

- Host bits = 10 → 2^10 - 2 = 1022 hosts ✅

- Subnet bits = 22 - 16 = 6 → 2^6 = 64 subnets ❌ (need 100)

FAILS: Not enough subnets!


What about /24?

/24:

- Subnet bits = 24 - 16 = 8 → 2^8 = 256 subnets ✅

- Host bits = 8 → 2^8 - 2 = 254 hosts ❌ (need 500)

FAILS: Not enough hosts!


Visual: How /23 Splits the Bits

172.30.0.0/16 Original:

172 . 30 . 0 . 0

────────────────────── ─────────────────────

11111111.11111111 00000000.00000000

└───────┬───────┘ └────────┬────────┘

16 Network bits 16 Host bits

172.30.0.0/23 After Subnetting:

172 . 30 . 0 . 0

────────────────────────────────── ─────────

11111111.11111111.0000000 0.00000000

└────────────┬────────────┘ └────┬────┘

23 Network bits 9 Host bits

(16 original + 7 borrowed)

└──────────────┘└───────┘ └─────────┘

Original 16 7 bits 9 bits

for subnets for hosts

(128 subnets) (510 hosts)





LAN1: 45 hosts

LAN2: 64 hosts

LAN3: 14 hosts

LAN4: 9 hosts

R1 is connect to R2 P2P

Subnet the 192.168.5.0/24 network to provide sufficient addressing for each LAN. (Also, the point-to-point connection between R1 and R2).

Assign the first usable address to the PC in each LAN.

Assign the last usable address to the router's interface in each LAN.

Configure static routes on each router so that all PCs can ping eachother.

📋 STEP 1: Analyze Requirements

Network

Hosts Needed

Hosts + Network + Broadcast

LAN2

64 hosts

64 + 2 = 66 addresses

LAN1

45 hosts

45 + 2 = 47 addresses

LAN3

14 hosts

14 + 2 = 16 addresses

LAN4

9 hosts

9 + 2 = 11 addresses

P2P

2 hosts

2 + 2 = 4 addresses


📋 STEP 2: Sort by Size (Largest First)

Why? We must allocate largest subnets first to avoid address overlap.

1. LAN2: 64 hosts (LARGEST)

2. LAN1: 45 hosts

3. LAN3: 14 hosts

4. LAN4: 9 hosts

5. P2P: 2 hosts (SMALLEST)


📋 STEP 3: Calculate Subnet Size for Each

Formula: 2ⁿ - 2 ≥ hosts needed (n = host bits)


LAN2 (64 hosts):

2⁶ - 2 = 62 ❌ (not enough)

2⁷ - 2 = 126 ✅ (enough!)

Host bits = 7

Network bits = 32 - 7 = 25

Subnet mask = /25 (255.255.255.128)

Block size = 128


LAN1 (45 hosts):

2⁵ - 2 = 30 ❌ (not enough)

2⁶ - 2 = 62 ✅ (enough!)

Host bits = 6

Network bits = 32 - 6 = 26

Subnet mask = /26 (255.255.255.192)

Block size = 64


LAN3 (14 hosts):

2³ - 2 = 6 ❌ (not enough)

2⁴ - 2 = 14 ✅ (exactly enough!)

Host bits = 4

Network bits = 32 - 4 = 28

Subnet mask = /28 (255.255.255.240)

Block size = 16


LAN4 (9 hosts):

2³ - 2 = 6 ❌ (not enough)

2⁴ - 2 = 14 ✅ (enough!)

Host bits = 4

Network bits = 32 - 4 = 28

Subnet mask = /28 (255.255.255.240)

Block size = 16


Point-to-Point (2 hosts):

2² - 2 = 2 ✅ (exactly enough!)

Host bits = 2

Network bits = 32 - 2 = 30

Subnet mask = /30 (255.255.255.252)

Block size = 4


📋 STEP 4: Assign Subnets Sequentially

Starting from 192.168.5.0:

┌─────────────────────────────────────────────────────────────┐

│ 192.168.5.0/24 │

│ (256 addresses) │

├─────────────────────────────────────────────────────────────┤

│ .0────────────────────────────────────────────.127 │ LAN2 │

│ .128─────────────────────────────.191 │ LAN1 │

│ .192────────────.207 │ LAN3 │

│ .208────────────.223 │ LAN4 │

│ .224────.227 │ P2P │

│ .228────.255 │ FREE │

└─────────────────────────────────────────────────────────────┘


📋 STEP 5: Complete Subnet Details

🔷 LAN2 - /25 (64 hosts needed)

Network Address: 192.168.5.0/25

Subnet Mask: 255.255.255.128

First Usable: 192.168.5.1 ← PC2

Last Usable: 192.168.5.126 ← Router Interface

Broadcast: 192.168.5.127

Usable Hosts: 126


Calculation:

Network: 192.168.5.0 = 192.168.5.00000000

Broadcast: 192.168.5.0 + 127 = 192.168.5.01111111 = 192.168.5.127

First: Network + 1 = 192.168.5.1

Last: Broadcast - 1 = 192.168.5.126


🔷 LAN1 - /26 (45 hosts needed)

Network Address: 192.168.5.128/26

Subnet Mask: 255.255.255.192

First Usable: 192.168.5.129 ← PC1

Last Usable: 192.168.5.190 ← Router Interface

Broadcast: 192.168.5.191

Usable Hosts: 62


Calculation:

Start after LAN2: 192.168.5.128

Block size: 64

Network: 192.168.5.128

Broadcast: 192.168.5.128 + 63 = 192.168.5.191

First: 192.168.5.129

Last: 192.168.5.190


🔷 LAN3 - /28 (14 hosts needed)

Network Address: 192.168.5.192/28

Subnet Mask: 255.255.255.240

First Usable: 192.168.5.193 ← PC3

Last Usable: 192.168.5.206 ← Router Interface

Broadcast: 192.168.5.207

Usable Hosts: 14


Calculation:

Start after LAN1: 192.168.5.192

Block size: 16

Network: 192.168.5.192

Broadcast: 192.168.5.192 + 15 = 192.168.5.207

First: 192.168.5.193

Last: 192.168.5.206


🔷 LAN4 - /28 (9 hosts needed)

Network Address: 192.168.5.208/28

Subnet Mask: 255.255.255.240

First Usable: 192.168.5.209 ← PC4

Last Usable: 192.168.5.222 ← Router Interface

Broadcast: 192.168.5.223

Usable Hosts: 14


Calculation:

Start after LAN3: 192.168.5.208

Block size: 16

Network: 192.168.5.208

Broadcast: 192.168.5.208 + 15 = 192.168.5.223

First: 192.168.5.209

Last: 192.168.5.222


🔷 Point-to-Point - /30 (2 hosts needed)

Network Address: 192.168.5.224/30

Subnet Mask: 255.255.255.252

First Usable: 192.168.5.225 ← R1 (Serial/G0/0/0)

Last Usable: 192.168.5.226 ← R2 (Serial/G0/0/0)

Broadcast: 192.168.5.227

Usable Hosts: 2


Calculation:

Start after LAN4: 192.168.5.224

Block size: 4

Network: 192.168.5.224

Broadcast: 192.168.5.224 + 3 = 192.168.5.227

First: 192.168.5.225

Last: 192.168.5.226



📋 STEP 6: Network Topology

NETWORK DIAGRAM

┌─────────┐ ┌─────────┐

│ PC1 │ │ PC3 │

│ .129 │ │ .193 │

└────┬────┘ └────┬────┘

│ │

│ LAN1 │ LAN3

│ 192.168.5.128/26 │ 192.168.5.192/28

│ │

┌────┴────┐ P2P Link ┌────┴────┐

│ R1 │ 192.168.5.224/30 │ R2 │

│ │.225 ══════════════════ .226 │ │

│ .190 │ │ .206 │

│ .126 │ │ .222 │

└────┬────┘ └────┬────┘

│ │

│ LAN2 │ LAN4

│ 192.168.5.0/25 │ 192.168.5.208/28

│ │

┌────┴────┐ ┌────┴────┐

│ PC2 │ │ PC4 │

│ .1 │ │ .209 │

└─────────┘ └─────────┘


📋 STEP 7: Summary Table

Network

Subnet

Mask

PC (First)

Router (Last)

Broadcast

LAN2

192.168.5.0/25

255.255.255.128

.1

.126

.127

LAN1

192.168.5.128/26

255.255.255.192

.129

.190

.191

LAN3

192.168.5.192/28

255.255.255.240

.193

.206

.207

LAN4

192.168.5.208/28

255.255.255.240

.209

.222

.223

P2P

192.168.5.224/30

255.255.255.252

.225 (R1)

.226 (R2)

.227


📋 STEP 8: Router Configurations

enable

configure terminal

hostname R1

! LAN1 Interface (45 hosts)

interface GigabitEthernet0/0/0

description LAN1

ip address 192.168.5.190 255.255.255.192

no shutdown

exit

! LAN2 Interface (64 hosts)

interface GigabitEthernet0/0/1

description LAN2

ip address 192.168.5.126 255.255.255.128

no shutdown

exit

! Point-to-Point to R2

interface Serial0/1/0

description P2P to R2

ip address 192.168.5.225 255.255.255.252

no shutdown

exit

! Static Routes to reach R2's networks

ip route 192.168.5.192 255.255.255.240 192.168.5.226

ip route 192.168.5.208 255.255.255.240 192.168.5.226

end

write memory


🔧 R2 Configuration

enable

configure terminal

hostname R2

! LAN3 Interface (14 hosts)

interface GigabitEthernet0/0/0

description LAN3

ip address 192.168.5.206 255.255.255.240

no shutdown

exit

! LAN4 Interface (9 hosts)

interface GigabitEthernet0/0/1

description LAN4

ip address 192.168.5.222 255.255.255.240

no shutdown

exit

! Point-to-Point to R1

interface Serial0/1/0

description P2P to R1

ip address 192.168.5.226 255.255.255.252

no shutdown

exit

! Static Routes to reach R1's networks

ip route 192.168.5.0 255.255.255.128 192.168.5.225

ip route 192.168.5.128 255.255.255.192 192.168.5.225

end

write memory



Author

abdullah S.

Information

Last changed