Skip to main content

Module 9: IP Addressing Deep Dive

This module takes you from basic IP understanding to complete mastery. You’ll learn to calculate subnets, understand CIDR notation, and deeply grasp how IP addressing works in real networks.
CIDR and Subnetting
Private vs Public IP Ranges
Estimated Time: 4-5 hours
Difficulty: Intermediate
Prerequisites: Module 4 (Network Layer basics)

9.1 The Complete Picture of IP Addresses

What is an IP Address Really?

An IP address is a logical address assigned to a device on a network. Unlike MAC addresses (which are burned into hardware), IP addresses are:
  • Configurable: Can be changed
  • Hierarchical: Contain network and host portions
  • Routable: Used to find paths across networks

IPv4 Address Structure

A 32-bit number, typically shown in dotted-decimal notation:
192.168.1.100

Binary: 11000000.10101000.00000001.01100100
        └──────┘ └──────┘ └──────┘ └──────┘
          192      168       1       100
Each octet (8 bits) can range from 0 to 255.

9.2 Network ID vs Host ID

Every IP address has two parts:
PartPurposeAnalogy
Network IDIdentifies the networkStreet name
Host IDIdentifies the specific deviceHouse number
The subnet mask determines where the split occurs.

Example

IP Address:    192.168.1.100
Subnet Mask:   255.255.255.0

Network ID:    192.168.1.0    (First 24 bits)
Host ID:       0.0.0.100      (Last 8 bits)
Mental Model: Think of the Network ID as your ZIP code (gets you to the right neighborhood) and Host ID as your street address (finds the exact house).

9.3 CIDR Notation Explained

CIDR (Classless Inter-Domain Routing) replaced the old class-based system. It uses a prefix length to indicate how many bits belong to the network portion.

The Notation

192.168.1.0/24
            └── 24 bits for network, 8 bits for hosts

Common CIDR Blocks

CIDRSubnet Mask# of HostsUse Case
/32255.255.255.2551Single host
/31255.255.255.2542Point-to-point links
/30255.255.255.2522Point-to-point (with network/broadcast)
/29255.255.255.2486Tiny subnet
/28255.255.255.24014Small subnet
/27255.255.255.22430Small office
/26255.255.255.19262Medium subnet
/25255.255.255.128126Large subnet
/24255.255.255.0254Standard LAN
/16255.255.0.065,534Large organization
/8255.0.0.016,777,214Massive network

Calculating Hosts

Number of usable hosts = 2^(32 - prefix) - 2

Example: /24 network
= 2^(32-24) - 2
= 2^8 - 2
= 256 - 2
= 254 usable hosts
Why -2? The first address is the Network Address (all host bits = 0) and the last is the Broadcast Address (all host bits = 1). Neither can be assigned to a host.

9.4 Subnetting Step-by-Step

Problem: Divide 192.168.1.0/24 into 4 equal subnets

Step 1: Determine bits needed
4 subnets = 2^n where n = 2
Need to borrow 2 bits from host portion
Step 2: Calculate new prefix
Original: /24
Borrowed: 2 bits
New prefix: /26
Step 3: Calculate subnet size
Hosts per subnet = 2^(32-26) - 2 = 62 hosts
Block size = 64 (2^6)
Step 4: List the subnets
SubnetNetwork AddressFirst HostLast HostBroadcast
1192.168.1.0/26192.168.1.1192.168.1.62192.168.1.63
2192.168.1.64/26192.168.1.65192.168.1.126192.168.1.127
3192.168.1.128/26192.168.1.129192.168.1.190192.168.1.191
4192.168.1.192/26192.168.1.193192.168.1.254192.168.1.255

Quick Subnet Cheat Sheet

For /24 networks being subnetted:
New PrefixSubnetsHosts/SubnetBlock Size
/252126128
/2646264
/2783032
/28161416
/293268
/306424

9.5 Private vs Public IP Addresses

The Problem

There are only ~4.3 billion IPv4 addresses (2^32), but billions of devices need to connect.

The Solution: Private IP Ranges

RFC 1918 reserved three blocks for private use:
RangeCIDR# of AddressesTypical Use
10.0.0.0 - 10.255.255.25510.0.0.0/816,777,216Large enterprises, Cloud VPCs
172.16.0.0 - 172.31.255.255172.16.0.0/121,048,576Medium organizations
192.168.0.0 - 192.168.255.255192.168.0.0/1665,536Home/Small office

Key Rules

Private IPs

  • Not routable on the public internet
  • Can be reused by any organization
  • Need NAT to reach the internet
  • Free to use, no registration needed

Public IPs

  • Globally unique and routable
  • Assigned by IANA → RIRs → ISPs
  • Must be purchased/leased
  • Required for internet-facing services

Can Multiple Organizations Use the Same Private IP?

Yes! This is exactly the point. Consider:
Company A Office:          Company B Office:
┌─────────────────┐        ┌─────────────────┐
│ 192.168.1.0/24  │        │ 192.168.1.0/24  │
│                 │        │                 │
│ PC: 192.168.1.5 │        │ PC: 192.168.1.5 │
│ PC: 192.168.1.6 │        │ PC: 192.168.1.6 │
└────────┬────────┘        └────────┬────────┘
         │                          │
    NAT Gateway               NAT Gateway
    Public: 203.0.113.10      Public: 198.51.100.20
         │                          │
         └──────────┬───────────────┘

              ┌─────┴─────┐
              │  Internet │
              └───────────┘
Both companies use 192.168.1.5 internally, but that’s fine because:
  1. Private IPs never leave their local network
  2. NAT translates them to unique public IPs before packets hit the internet
  3. The internet only sees the public IPs

9.6 Special IP Addresses

Address/RangePurpose
0.0.0.0”This network” / Default route
127.0.0.0/8Loopback (localhost)
169.254.0.0/16Link-local (APIPA) - when DHCP fails
224.0.0.0/4Multicast
255.255.255.255Broadcast

9.7 IPv6 Addressing

Why IPv6?

IPv4 has ~4.3 billion addresses. IPv6 has:
2^128 = 340,282,366,920,938,463,463,374,607,431,768,211,456 addresses
That’s 340 undecillion addresses - enough to assign trillions of addresses to every grain of sand on Earth.

IPv6 Format

2001:0db8:85a3:0000:0000:8a2e:0370:7334

8 groups of 4 hexadecimal digits (16 bits each)
Total: 128 bits

Simplification Rules

  1. Leading zeros can be omitted:
    2001:0db8 → 2001:db8
    
  2. Consecutive zero groups can be replaced with :: (once per address):
    2001:0db8:0000:0000:0000:0000:0000:0001
    → 2001:db8::1
    

IPv6 Address Types

TypePrefixDescription
Global Unicast2000::/3Public, routable (like IPv4 public)
Link-Localfe80::/10Auto-configured, not routable
Unique Localfc00::/7Private (like RFC 1918)
Loopback::1Localhost

9.8 Practice Problems

Solution:
/8 has 24 bits for hosts (32 - 8 = 24)
/24 has 8 bits for hosts (32 - 24 = 8)

Bits to borrow: 24 - 8 = 16 bits
Number of /24 networks: 2^16 = 65,536

Answer: You can create 65,536 /24 networks from a /8
Solution:
/26 means 26 network bits, 6 host bits
Block size = 2^6 = 64

172.16.45.130 ÷ 64 = 2.03... → Subnet starts at 2 × 64 = 128

Network: 172.16.45.128/26
Range: 172.16.45.128 - 172.16.45.191
Broadcast: 172.16.45.191
Requirements:
  • Engineering: 50 hosts
  • Sales: 20 hosts
  • HR: 10 hosts
  • Starting block: 192.168.10.0/24
Solution:
DeptHosts NeededSubnet SizeCIDRRange
Engineering50/26 (62 hosts)192.168.10.0/26.1 - .62
Sales20/27 (30 hosts)192.168.10.64/27.65 - .94
HR10/28 (14 hosts)192.168.10.96/28.97 - .110
Remaining: 192.168.10.112 - 192.168.10.255 (for future use)

9.9 Key Takeaways

CIDR is Essential

Master /24, /26, /28 calculations. They appear in every cloud and network config.

Private IPs are Infinite

10.x.x.x can be used by millions of organizations simultaneously.

Always Plan for Growth

Leave room in your subnetting for future expansion.

IPv6 is Coming

No NAT needed, every device gets a public IP.

Next Module

Module 10: NAT & PAT Deep Dive

Understand how private networks communicate with the internet through Network Address Translation.