Information Technology & Programming #IP Addressing #Subnetting #Networking Basics #Computer Operator Training

Understanding IP Addressing and Subnetting Basics for Networking

Tulasi Nepali
Tulasi Nepali Developer & Educator
Oct 16, 2026 Updated Oct 16, 2026
Understanding IP Addressing and Subnetting Basics for Networking
Font:

Tulasi Nepali Learning Platform

tulasinepali.com.np • Official Educational & Exam Preparation Notes

Date: 2026-10-16
Subject: Information Technology & Programming

Overview & Definition (परिचय तथा परिभाषा)

Internet Protocol (IP) addressing is the foundation of all computer networks. An IP address uniquely identifies a device on a TCP/IP network, allowing data to be routed from source to destination. Subnetting divides a larger network into smaller, manageable sub‑networks (subnets) to improve performance, security, and address utilization.

Core Concepts (मुख्य अवधारणाहरू)

1. IPv4 Address Structure

IPv4 uses a 32‑bit binary number, usually written in dotted‑decimal notation (e.g., 192.168.10.25). The 32 bits are split into four octets (8 bits each). Each octet ranges from 0 to 255.

2. Network & Host Portions

The address is divided into a network part (identifies the network) and a host part (identifies a device within that network). The division is defined by the subnet mask.

3. Subnet Mask

A subnet mask is also a 32‑bit number that indicates which bits belong to the network. Common masks are written in dotted‑decimal (e.g., 255.255.255.0) or CIDR notation (e.g., /24).

4. Classful Addressing (Class A, B, C)

Historically, IP addresses were grouped into classes based on the first octet:

  • Class A: 0‑127 first octet, default mask /8 (255.0.0.0). Supports ~16 million hosts per network.
  • Class B: 128‑191 first octet, default mask /16 (255.255.0.0). Supports ~65 000 hosts per network.
  • Class C: 192‑223 first octet, default mask /24 (255.255.255.0). Supports up to 254 hosts per network.

Classful addressing is largely superseded by CIDR, but the class concepts remain essential for exam preparation.

5. CIDR (Classless Inter‑Domain Routing)

CIDR allows flexible prefix lengths (e.g., /22, /27) to allocate exactly the number of addresses needed, reducing waste.

6. Calculating Subnet Masks

To create a subnet mask for a required number of hosts:

  1. Determine the minimum host bits needed: 2^n - 2 ≥ required hosts (subtract 2 for network and broadcast addresses).
  2. Subtract host bits from 32 to get the prefix length (e.g., 32‑n = /prefix).
  3. Write the mask: set the first prefix bits to 1, remaining bits to 0, then convert each octet to decimal.

Key Points / Rules / Functions

  • Every IPv4 address belongs to a network and a host portion defined by its mask.
  • The first address in a subnet is the network address (all host bits 0).
  • The last address is the broadcast address (all host bits 1).
  • Usable host range lies between network+1 and broadcast‑1.
  • Subnet masks must consist of contiguous 1s followed by contiguous 0s; non‑contiguous masks are invalid.
  • When subnetting a Class C network, each additional borrowed bit doubles the number of subnets and halves the hosts per subnet.
  • For exam calculations, memorise the binary‑decimal equivalents of common masks (e.g., /25 = 255.255.255.128).

Comparison Table

ClassFirst Octet RangeDefault MaskNetwork BitsHost BitsUsable Hosts
A0‑127255.0.0.0 (/8)82416,777,214
B128‑191255.255.0.0 (/16)161665,534
C192‑223255.255.255.0 (/24)248254

Practical Application / Real‑World Relevance

Network administrators use subnetting to:

  • Segment a corporate LAN into departments (HR, Finance, IT) for security and traffic control.
  • Conserve IPv4 address space in data‑centers by allocating only the needed hosts per VLAN.
  • Design efficient routing tables, reducing router lookup time.
  • Implement VPNs where each remote site receives a distinct subnet.

In Nepal, many government and private institutions still rely on IPv4. Mastery of subnetting ensures you can configure routers, firewalls, and switches correctly for local networks and for certification exams such as NTC, ICT, and CompTIA Network+.

Quick Review Questions & Answers (अभ्यासका लागि प्रश्नोत्तर)

  1. Q: What is the default subnet mask for a Class B address?
    A: 255.255.0.0 (or /16).
  2. Q: How many usable hosts are available in a /27 subnet?
    A: 2^(32‑27)‑2 = 2^5‑2 = 30 hosts.
  3. Q: An organization needs at most 50 hosts per subnet. What is the smallest CIDR prefix you can use?
    A: Need 6 host bits (2^6‑2=62). Prefix = 32‑6 = /26.
  4. Q: Convert the mask 255.255.255.192 to CIDR notation.
    A: Binary: 11111111.11111111.11111111.11000000 → 26 ones → /26.
  5. Q: In the subnet 192.168.10.0/24, what is the broadcast address?
    A: 192.168.10.255.
  6. Q: If you borrow 3 bits from a Class C network, how many subnets and hosts per subnet are created?
    A: Subnets = 2^3 = 8; Hosts per subnet = 2^(8‑3)‑2 = 30.

Use these questions for self‑assessment before the exam. Practice converting between binary and decimal, and always verify the network, broadcast, and usable ranges.