Recall warm-up
- How many bits are in one octet of an IPv4 address, and what is its decimal range?
Stuck? Peek at 3.1.1 IPv4 address structure, dotted decimal, net-id vs host-id
- IPv4 address = 32 bits = 4 octets (0–255 each), total space = 2³².
- Split: Net-ID (left n bits) + Host-ID (right h = 32 − n bits).
- Identifies a network interface (routers have one IP per link).
- What is the 48-bit broadcast MAC address in Ethernet?
Stuck? Peek at 2.4.1 Ethernet frame format, MAC address types, minimum and maximum frame sizes
- Frame: preamble 7 + SFD 1 | dest 6 | src 6 | type/len 2 | data 46–1500 | CRC 4.
- Frame 64–1518 bytes (preamble excluded); pad data to 46.
- MTU = 1500 bytes.
- First-byte LSB 1 → multicast; FF:…:FF → broadcast; else unicast.
- 64 bytes = 512 bits = CSMA/CD slot time at 10 Mbps.
- What is the decimal value of the 8-bit binary number 11100000?
Stuck? Peek at 0.2.2 Binary, decimal and hex; powers of 2
- Binary places: 1, 2, 4, 8, 16, 32, 64, 128, …; MSB left, LSB right.
- Hex: one digit = 4 bits; A–F = 10–15; group from the right.
- k bits → 2ᵏ values, 0 … 2ᵏ − 1.
- Bits needed for N values = smallest k with 2ᵏ ≥ N.
- 2¹⁰ = 1024 · 2¹⁶ = 65,536 · 2²⁰ ≈ 1.05 M · 2³² ≈ 4.29 × 10⁹.
The Hook
When IPv4 was designed in 1981, engineers wanted every router to know the boundary between net-id and host-id instantly just by looking at the first few bits of the address itself. So they carved the 2³² space into five fixed-size classes (A, B, C, D, E).
Although modern networks have replaced fixed classes with flexible boundaries (3.1.4), GATE regularly tests class ranges, default masks, and the reserved special addresses inside every block.
Predict First
In a network with 8 host bits (2⁸ = 256 addresses), why can you only assign 254 of those addresses to actual computers?
,Because two extreme host-id patterns are reserved in every network: all-0s in the host part is the network address (identifies the network itself), and all-1s in the host part is the directed broadcast address (sends to all hosts on that network).
Core Concept
Leading bit pattern & first-octet ranges (Classes A–E)
The position of the first 0 bit in the first octet tells you the class:
- Class A starts with
0...→ first octet 0–127 (half of the entire IPv4 space!). Net-id = 1 octet (8 bits), Host-id = 3 octets (24 bits). - Class B starts with
10...→ first octet 128–191 (1/4 of space). Net-id = 2 octets (16 bits), Host-id = 2 octets (16 bits). - Class C starts with
110...→ first octet 192–223 (1/8 of space). Net-id = 3 octets (24 bits), Host-id = 1 octet (8 bits). - Class D starts with
1110...→ first octet 224–239 (1/16 of space). Used for multicast (one-to-many group delivery; no net/host split). - Class E starts with
1111...→ first octet 240–255 (1/16 of space). Reserved / experimental.
| Class | Leading bits | 1st Octet Range | Net : Host bits | Default Mask (first n bits = 1) | Usable Hosts per net |
|---|---|---|---|---|---|
| A | 0 | 0 – 127* | 8 : 24 | 255.0.0.0 | 2²⁴ − 2 = 16,777,214 |
| B | 10 | 128 – 191 | 16 : 16 | 255.255.0.0 | 2¹⁶ − 2 = 65,534 |
| C | 110 | 192 – 223 | 24 : 8 | 255.255.255.0 | 2⁸ − 2 = 254 |
| D | 1110 | 224 – 239 | Multicast (no split) | — | — |
| E | 1111 | 240 – 255 | Reserved | — | — |
Network address vs Directed Broadcast address
Inside any unicast network (Class A, B, or C) with h host bits:
- Network address (host-id = all
0s): names the network itself; never assigned to a host, never appears as a destination IP in a normal packet. - Directed broadcast address (host-id = all
1s): reaches every host on that target network. - Usable host addresses = 2ʰ − 2 (from network address + 1 up to broadcast address − 1).
Five special IPv4 addresses you must know for GATE
Several patterns have fixed meanings across the entire Internet:
| Address / Block | Name | Meaning & Allowed Use |
|---|---|---|
| 0.0.0.0 | This host ("unspecified") | Source IP only, used when a booting host does not know its own IP yet. Never a valid destination IP. |
| 255.255.255.255 | Limited broadcast | Destination IP only: broadcasts to every host on the current local network (LAN). Routers NEVER forward 255.255.255.255! |
| Net-ID . all-1s (e.g. 200.1.2.255) | Directed broadcast | Destination IP only: broadcasts to all hosts on the specified target network. |
| 127.0.0.0 – 127.255.255.255 (e.g. 127.0.0.1) | Loopback | Tests the networking software on the same host. Packet never leaves the host or touches any link! |
| 224.0.0.0 – 239.255.255.255 | Class D Multicast | Destination IP only: delivers to a group of subscribed hosts. Never a valid source IP. |
Putting it together
- Classful addressing fixes the net/host boundary using the leading bits: A (0–127, 8 net), B (128–191, 16 net), C (192–223, 24 net), D (224–239, multicast), E (240–255, reserved).
- Every network reserves all-0s host bits as the network address and all-1s host bits as the directed broadcast, leaving 2ʰ − 2 usable hosts.
- 0.0.0.0 (this host), 255.255.255.255 (limited broadcast), and 127.x.y.z (loopback) have special rules tested frequently on GATE.
Visual
Worked Examples
How many usable hosts per network does a standard Class B network support?
Show the full solution
Class B has 2 octets = 16 bits for the host part. Subtracting the all-0s network address and all-1s directed broadcast address gives 2¹⁶ − 2 = 65536 − 2 = 65534 usable hosts.
Given the host IPv4 address 210.45.12.7 under classful addressing, find its class, default mask, network address, directed broadcast address, and usable host range.
Show the full solution
First octet is 210, which lies in 192–223 → Class C.
Default mask (24 net bits) = 255.255.255.0.
Network address (host octet = 0) = 210.45.12.0.
Directed broadcast (host octet = 255) = 210.45.12.255.
Usable hosts = 210.45.12.1 to 210.45.12.254 (254 hosts).
A host sends a packet with destination IP 255.255.255.255 and another packet with destination IP 127.0.0.5. How many routers forward each packet?
Show the full solution
255.255.255.255 is the limited broadcast address: it is delivered to all hosts on the sender's local LAN, and routers never forward it (0 routers forward it).127.0.0.5 is in the 127.x.y.z loopback block: it loops back inside the host's own network layer and never even enters the link (0 routers forward it).
GATE Traps
- 127.x.y.z is wasted! All 2²⁴ addresses starting with 127 (not just 127.0.0.1) are reserved for loopback, so Class A has 126 usable networks (1..126), not 128.
- Limited vs Directed Broadcast:
255.255.255.255stops at the first router (local LAN only);172.16.255.255(Class B directed broadcast) can be routed to network172.16.0.0and then broadcast there. - Why classful died: A company needing 300 hosts couldn't fit in Class C (254) and had to take a Class B (65,534), wasting over 65,200 addresses!
Memory Hook
0, 128, 192, 224, 240 — keep halving the remaining pie (128, +64, +32, +16) for A, B, C, D, E!
Connect the Dots
Classful addressing wasted millions of addresses because a Class B network forced all 65,534 hosts into a single giant LAN. Next question (3.1.3): How can an organisation take one Class B block and slice it internally into dozens of smaller networks?
Self-Test
- MCQ
To which IPv4 class does the address 191.255.10.1 belong, and what is its default mask?
- Class A, 255.0.0.0
- Class B, 255.255.0.0
- Class C, 255.255.255.0
- Class D, no mask
- NAT
In a standard Class C network, how many usable host addresses are available?
Write your answer before opening the key.
- MSQ
Which of the following IPv4 addresses can NEVER be used as the source IP address of a valid packet on a link?
- 224.0.1.10
- 255.255.255.255
- 192.168.1.0 (in a standard Class C network)
- 192.168.1.1 (in a standard Class C network)
- MCQ
What fraction of the total IPv4 address space is occupied by Class C addresses?
- 1/2 (50%)
- 1/4 (25%)
- 1/8 (12.5%)
- 1/16 (6.25%)
- MCQ
A host sends a packet to destination 127.15.20.1. What happens to the packet?
- It is broadcast on the local Ethernet.
- It is forwarded by the default router to network 127.
- It is looped back inside the sending host by the network layer and never transmitted on any link.
- It is dropped as an invalid Class E address.
Rule Card
- Classes by 1st octet: A = 0–127 (
0, 8 net bits), B = 128–191 (10, 16 net bits), C = 192–223 (110, 24 net bits), D = 224–239 (1110, multicast), E = 240–255 (1111, reserved). - Usable hosts = 2ʰ − 2 (exclude host all-0s = network address, host all-1s = directed broadcast).
- Specials:
0.0.0.0= this host (src only);255.255.255.255= limited broadcast (local LAN only);127.x.y.z= loopback.
Concept Ledger
- classful addressing
- classes A/B/C/D/E
- default mask
- network address
- directed broadcast
- limited broadcast (255.255.255.255)
- loopback (127.x.y.z)
- 0.0.0.0
- multicast (Class D)
Answer Vault
Try the questions first. Open when you are ready to check.
Warm-up answers
- 8 bits; decimal 0 to 255.
- FF:FF:FF:FF:FF:FF (all 48 bits set to 1).
- 128 + 64 + 32 = 224.
Self-test answers
- B — First octet 191 falls in 128–191 → Class B, with 16 network bits (255.255.0.0).
- A: Class A is 0–127.
- C: Class C starts at 192.
- D: Class D starts at 224.
- 254 — Class C has 8 host bits → 2⁸ − 2 = 256 − 2 = 254 usable hosts.
- ABC — 224.0.1.10 is Class D multicast (destination only); 255.255.255.255 is limited broadcast (destination only); 192.168.1.0 is the Class C network address (all-0 host bits). Only 192.168.1.1 is a valid unicast host IP.
- D: 192.168.1.1 is a valid usable host address.
- C — Class C addresses always begin with the 3 fixed bits 110, leaving 29 bits → 2²⁹ / 2³² = 1/8 = 12.5%.
- A: Class A occupies 1/2.
- B: Class B occupies 1/4.
- D: Classes D and E each occupy 1/16.
- C — Every address in 127.0.0.0 – 127.255.255.255 is a loopback address processed internally.
- A: Loopback never goes onto the LAN.
- B: Loopback packets never leave the host.
- D: 127 is at the end of Class A, reserved for loopback.
Flashcards
- First-octet ranges for Classes A, B, C, D, E?
Reveal answer
A: 0–127, B: 128–191, C: 192–223, D: 224–239, E: 240–255. - Why is the number of usable hosts 2ʰ − 2?
Reveal answer
Host-id all-0s is the network address; host-id all-1s is the directed broadcast address. - Difference between 255.255.255.255 and a directed broadcast?
Reveal answer
255.255.255.255 (limited broadcast) stays on the local LAN and is never forwarded by routers; a directed broadcast targets a specific network. - What happens to a packet sent to 127.0.0.1?
Reveal answer
It loops back inside the host’s own protocol stack and never touches the physical link.
Exam shortcuts
- First-octet boundary ladder: add 128, 64, 32, 16 → starts of A, B, C, D, E are 0, 128, 192, 224, 240. — identifying the class of any dotted-decimal IPv4 address instantly.
- Source vs Destination legality: Broadcast and Multicast addresses can only be destinations;
0.0.0.0can only be a source. — GATE MSQs asking "Which of the following can never be a valid source/destination IP?"