Tulasi Nepali Learning Platform
tulasinepali.com.np • Official Educational & Exam Preparation Notes
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:
- Determine the minimum host bits needed:
2^n - 2 ≥ required hosts(subtract 2 for network and broadcast addresses). - Subtract host bits from 32 to get the prefix length (e.g., 32‑n = /prefix).
- Write the mask: set the first
prefixbits 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
| Class | First Octet Range | Default Mask | Network Bits | Host Bits | Usable Hosts |
|---|---|---|---|---|---|
| A | 0‑127 | 255.0.0.0 (/8) | 8 | 24 | 16,777,214 |
| B | 128‑191 | 255.255.0.0 (/16) | 16 | 16 | 65,534 |
| C | 192‑223 | 255.255.255.0 (/24) | 24 | 8 | 254 |
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 (अभ्यासका लागि प्रश्नोत्तर)
- Q: What is the default subnet mask for a Class B address?
A: 255.255.0.0 (or /16). - Q: How many usable hosts are available in a /27 subnet?
A: 2^(32‑27)‑2 = 2^5‑2 = 30 hosts. - 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. - Q: Convert the mask 255.255.255.192 to CIDR notation.
A: Binary: 11111111.11111111.11111111.11000000 → 26 ones → /26. - Q: In the subnet 192.168.10.0/24, what is the broadcast address?
A: 192.168.10.255. - 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.