Computer Networks · TEE · papers
Q1(a) · Subnet mask
2024-02-06 · AI-only Sem V variant
Exact historical variant. Current-syllabus questions solved; excluded topics and source limitations stated.
Q1(a). Explain why a subnet mask is required in IPv4 addressing. [5 marks]
Answer
Definition. Subnetting divides an address block into smaller prefix-defined blocks. In an ordinary subnet, the network and directed-broadcast addresses bound its usable host range.
Simple meaning. Pehle block nikalo; phir first aur last. Uske baad hosts.
Understand it step by step
- Read /p. Host bits h=32−p. Total addresses N=2ʰ, not N−2.
- Build the mask. Find the first octet that is not 255; block step there is 256−that mask octet.
- Round that address octet down to a multiple of the step. Preserve preceding octets and set later octets to 0 for the network address.
- For the broadcast address, use the end of the same interval in the changing octet and set later octets to 255. Equivalently, broadcast is network+(N−1) in 32-bit address arithmetic.
- For an ordinary broadcast subnet with at least two host bits: first usable=network+1, last usable=broadcast−1, usable count=N−2. /31 point-to-point and /32 routes are exceptions explained separately.
N=2^{32-p}\text{block step}=256-\text{changing mask octet}\text{ordinary usable hosts}=2^h-2A /26 has 32−26=6 host bits, so it contains 2⁶=64 total addresses. Under ordinary IPv4 subnet rules, one is the network address and one is directed broadcast, leaving 64−2=62 usable host addresses.
Yaad rakho: Total mein sab count; usable mein boundary ke 2 minus.
An IPv4 address identifies an IP interface. The network prefix selects the destination network; remaining bits identify an address within it. Classful addressing is historical; modern routing uses explicit CIDR prefixes.
| Class | First octet | Default mask | Network / host split | Purpose |
|---|---|---|---|---|
| A | 1–126 (ordinary unicast) | 255.0.0.0 (/8) | 8 / 24 bits | Large historical unicast networks; 0 and 127 reserved |
| B | 128–191 | 255.255.0.0 (/16) | 16 / 16 bits | Medium historical unicast networks |
| C | 192–223 | 255.255.255.0 (/24) | 24 / 8 bits | Small historical unicast networks |
| D | 224–239 | No unicast default mask | Not network/host class split | Multicast |
| E | 240–255 | No unicast default mask | Not normal unicast allocation | Reserved/experimental; special addresses exist |
Example: 114.34.2.8 is class A with network 114.0.0.0 and host portion 34.2.8. Class does not override an explicitly supplied CIDR prefix.
Example: 192.168.1.70 AND255.255.255.192 gives network192.168.1.64. The mask distinguishes the network prefix from the host portion. CIDR masks need not equal historical default class masks.