Lab 09 - Subnetting & Routing

Back to Labs

Lab Objective

Learn subnetting concepts, CIDR notation, static routing, and dynamic routing using RIP. Understand how to divide networks and configure routing protocols.

⭐ 1. Subnetting

Subnetting = breaking a bigger network into smaller networks.

Why subnet?

  • To separate departments
  • To improve security
  • To reduce broadcast traffic
  • To assign IP ranges according to needs

1.1 How IP Networks Work

An IPv4 address has two parts: Network Portion | Host Portion

Subnet mask tells which part is network.

Example:

IP: 192.168.10.0

Default mask (Class C): 255.255.255.0

Meaning:

Network = 192.168.10

Host range = last octet (0–255)

2. Class A, B, C Addressing

Class Range Network Bits Hosts
A 1–126 8 bits 16 million hosts
B 128–191 16 bits 65,000 hosts
C 192–223 24 bits 254 hosts

Class C is smallest; often used in labs.

3. Creating Subnets

Subnetting cuts host portion into smaller pieces.

Subnetting Formulas

Number of Subnets = 2ⁿ
(where n = borrowed bits)

Hosts per Subnet = 2ʰ – 2
(where h = remaining host bits)

3.1 Example — Subnetting a Class C Network

Given:

Network: 200.100.50.0

Required: 7 subnets

Step 1 — Borrow bits

2³ = 8 ≥ 7 → borrow 3 bits

Step 2 — New mask

Default mask = 255.255.255.0

Borrow 3 bits → add (128+64+32) = 224

So new mask: 255.255.255.224 (/27)

Step 3 — Subnet increment

224 subnet → increment = 32
(256 – 224 = 32)

Step 4 — Subnets:

Subnet Network Range Broadcast
1 200.100.50.0 1–30 .31
2 .32 33–62 63
3 .64 65–94 95
4 .96 97–126 127
5 .128 129–158 159
6 .160 161–190 191
7 .192 193–222 223
8 .224 225–254 255

You used 7, so first seven are used.

Interactive Subnetting Calculator

Practice subnetting calculations in real-time!

⭐ Practical Subnetting Examples Based on Host Requirements

Example 1: 24 Usable Hosts Required

Given: Network 192.168.1.0/24, need 24 usable hosts per subnet

Step 1 — Calculate host bits needed

We need 24 usable hosts → 2ʰ - 2 ≥ 24

2⁵ - 2 = 30 ≥ 24 → need 5 host bits

Step 2 — Calculate subnet mask

Original: /24 (255.255.255.0)

Host bits needed: 5 → Network bits: 32 - 5 = 27

New mask: /27 (255.255.255.224)

Step 3 — Subnet details

Subnet Network ID Usable Range Broadcast Total Hosts
1 192.168.1.0 192.168.1.1 - 192.168.1.30 192.168.1.31 30
2 192.168.1.32 192.168.1.33 - 192.168.1.62 192.168.1.63 30
3 192.168.1.64 192.168.1.65 - 192.168.1.94 192.168.1.95 30

Example 2: 10 Usable Hosts Required

Given: Network 172.16.0.0/16, need 10 usable hosts per subnet

Step 1 — Calculate host bits needed

We need 10 usable hosts → 2ʰ - 2 ≥ 10

2⁴ - 2 = 14 ≥ 10 → need 4 host bits

Step 2 — Calculate subnet mask

Original: /16 (255.255.0.0)

Host bits needed: 4 → Network bits: 32 - 4 = 28

New mask: /28 (255.255.255.240)

Step 3 — Subnet details (first few subnets)

Subnet Network ID Usable Range Broadcast Total Hosts
1 172.16.0.0 172.16.0.1 - 172.16.0.14 172.16.0.15 14
2 172.16.0.16 172.16.0.17 - 172.16.0.30 172.16.0.31 14
3 172.16.0.32 172.16.0.33 - 172.16.0.46 172.16.0.47 14

Example 3: 120 Usable Hosts Required

Given: Network 10.0.0.0/8, need 120 usable hosts per subnet

Step 1 — Calculate host bits needed

We need 120 usable hosts → 2ʰ - 2 ≥ 120

2⁷ - 2 = 126 ≥ 120 → need 7 host bits

Step 2 — Calculate subnet mask

Original: /8 (255.0.0.0)

Host bits needed: 7 → Network bits: 32 - 7 = 25

New mask: /25 (255.255.255.128)

Step 3 — Subnet details

Subnet Network ID Usable Range Broadcast Total Hosts
1 10.0.0.0 10.0.0.1 - 10.0.0.126 10.0.0.127 126
2 10.0.0.128 10.0.0.129 - 10.0.0.254 10.0.0.255 126
3 10.0.1.0 10.0.1.1 - 10.0.1.126 10.0.1.127 126

Example 4: 2 Usable Hosts Required (Point-to-Point)

Given: Network 192.168.100.0/24, need 2 usable hosts per subnet (for router links)

Step 1 — Calculate host bits needed

We need 2 usable hosts → 2ʰ - 2 ≥ 2

2² - 2 = 2 ≥ 2 → need 2 host bits

Step 2 — Calculate subnet mask

Original: /24 (255.255.255.0)

Host bits needed: 2 → Network bits: 32 - 2 = 30

New mask: /30 (255.255.255.252)

Step 3 — Subnet details (first few subnets)

Subnet Network ID Usable Range Broadcast Total Hosts
1 192.168.100.0 192.168.100.1 - 192.168.100.2 192.168.100.3 2
2 192.168.100.4 192.168.100.5 - 192.168.100.6 192.168.100.7 2
3 192.168.100.8 192.168.100.9 - 192.168.100.10 192.168.100.11 2

4. CIDR (Classless Inter-Domain Routing)

CIDR allows any subnet mask, not just classful.

Instead of: 255.255.255.0

You can write: /24

Each / value tells how many NETWORK bits are used.

Example: 192.168.10.0/27

Means: 27 bits for network, 5 bits for hosts.

5. Static Routing

Static routing = manually adding routes.

Used when:

  • Small networks
  • Predictable paths
  • You want strict control
ip route <DESTINATION> <MASK> <NEXT-HOP>

6. Administrative Distances (AD)

AD rates the trustworthiness of routing information. An integer from 0 to 255 is assigned. Lower is better (more trusted).

If a router learns two paths to the same network via different protocols, it chooses the one with the lowest AD.

Route Source Default AD
Connected Interface 0
Static Route 1
EIGRP 90
OSPF 110
RIP 120
External EIGRP 170
Unknown 255 (Unreachable)

7. Classes of Routing Protocols

Distance Vector

Works by counting "hops" (jumps) to the destination. Best route = fewest hops. Example: RIP, IGRP.

Link State (Shortest Path First)

Routers know the entire network topology map. They share connectivity details, not just routing tables. Example: OSPF.

Hybrid

Combines aspects of Distance Vector and Link State. Example: EIGRP.

Path Vector

Used for routing between Autonomous Systems (AS) on the internet. It records the sequence of ASes a route passes through. Example: BGP.

8. Introduction to Dynamic Routing (RIP)

Dynamic routing protocols automatically update routing tables. They save time but use more CPU and bandwidth.

Routing Information Protocol (RIP)

  • Type: Distance-Vector protocol.
  • Updates: Sends the complete routing table every 30 seconds.
  • Metric: Uses Hop Count.
  • Limit: Max hop count is 15. A hop count of 16 is considered unreachable.
  • Usage: Good for small networks, but inefficient for large WANs.

RIP Configuration Commands

router rip
ver 2
network <network_id>    !-- for all the connected networks
no auto-summary

Lab Resources

Lab 09 Task

Download PDF