A subnet mask is a 32-bit number used in conjunction with an IP address to divide a network into smaller sub-networks (subnets) by identifying which bits of the IP address represent the network portion and which represent the host portion. Written in dotted-decimal notation (e.g., 255.255.255.0) or CIDR notation (e.g., /24), it enables routers and devices to determine whether a destination address is on the local network or must be forwarded to another network. Subnetting improves network performance, security, and efficient use of IP address space.
Hosts per subnet = 2^h - 2
LaTeX: \text{Hosts per subnet} = 2^{h} - 2
| Symbol | Meaning | Unit |
|---|---|---|
| h | Number of host bits (bits set to 0 in the mask) | bits |
| 2 | Binary base | none |
| -2 | Subtract network address and broadcast address | none |
Problem
A network uses IP address 192.168.1.0 with subnet mask 255.255.255.0 (/24). How many usable host addresses are available?
Solution
Step 1: Identify host bits. Subnet mask /24 means 24 bits are network bits, leaving 32 - 24 = 8 host bits. Step 2: Calculate total addresses. 2^8 = 256 total addresses. Step 3: Subtract unusable addresses. 256 - 2 = 254 (subtract network address 192.168.1.0 and broadcast address 192.168.1.255). Step 4: Usable range = 192.168.1.1 to 192.168.1.254.
Answer
254 usable host addresses (192.168.1.1 – 192.168.1.254)
| CIDR | Subnet Mask | Host Bits | Usable Hosts | Example Use |
|---|---|---|---|---|
| /8 | 255.0.0.0 | 24 | 16,777,214 | Class A large network |
| /16 | 255.255.0.0 | 16 | 65,534 | Class B medium network |
| /24 | 255.255.255.0 | 8 | 254 | Small office LAN |
| /28 | 255.255.255.240 | 4 | 14 | Small VLAN segment |
| /30 | 255.255.255.252 | 2 | 2 | Point-to-point link |
Wikimedia Commons, CC BY-SA
An IP (Internet Protocol) address is a unique numerical label assigned to each device connected to a computer network that uses the Internet Protocol for communication. IPv4 addresses are 32-bit numbers typically written in dotted-decimal notation (e.g., 192.168.1.1), providing approximately 4.3 billion unique addresses, while IPv6 addresses are 128-bit numbers written in hexadecimal (e.g., 2001:0db8:85a3::8a2e:0370:7334) to accommodate the growing number of internet-connected devices. IP addresses serve two principal functions: host or network interface identification and location addressing.
Network routing is the process by which routers select the optimal path for data packets to travel from a source to a destination across one or more networks. Routers maintain routing tables — databases of known network paths — and use routing protocols such as OSPF, BGP, and RIP to dynamically discover and share path information. Routing decisions are based on metrics including hop count, bandwidth, latency, and cost, ensuring efficient and reliable delivery of data across complex internetworks.
TCP/IP (Transmission Control Protocol/Internet Protocol) is the foundational suite of communication protocols used to interconnect network devices on the internet and most private networks. TCP handles reliable, ordered delivery of data by breaking messages into packets, acknowledging receipt, and retransmitting lost segments, while IP handles addressing and routing each packet to its destination. Together they form the backbone of modern digital communication, enabling everything from web browsing to email.
The term "subnet" is a portmanteau of "sub-network," introduced with CIDR (Classless Inter-Domain Routing) in RFC 1519 (1993). "Mask" refers to the bitwise AND operation applied to an IP address to extract the network portion, analogous to a physical mask that covers part of a face. The concept was developed to address IPv4 address exhaustion.