CS Atlas GATE 2027
Computer Networks course
0 / 90 complete

Computer Networks/Phase 3 · Network Layer

Lesson 3.1.2 · Item 42 of 90

Classful addressing (A–E) and special IPv4 addresses

Read at your own pace. Try the questions before opening the answers.

On this page

Recall warm-up

  1. 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).

    Read lesson 3.1.1

  2. 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.

    Read lesson 2.4.1

  3. 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⁹.

    Read lesson 0.2.2

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.
ClassLeading bits1st Octet RangeNet : Host bitsDefault Mask (first n bits = 1)Usable Hosts per net
A00 – 127*8 : 24255.0.0.02²⁴ − 2 = 16,777,214
B10128 – 19116 : 16255.255.0.02¹⁶ − 2 = 65,534
C110192 – 22324 : 8255.255.255.02⁸ − 2 = 254
D1110224 – 239Multicast (no split)——
E1111240 – 255Reserved——
*In Class A, net-id 0 (0.0.0.0) and 127 (127.x.y.z loopback) are reserved, leaving 2⁷ − 2 = 126 usable Class A networks (1..126).

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).
Net Addr (all 0s)0–0
Usable Hosts (1 .. 254)1–254
Broadcast (all 1s)255–255
0255
Inside a Class C network (256 addresses): 0 is the network address, 255 is directed broadcast, 1..254 are usable.

Five special IPv4 addresses you must know for GATE

Several patterns have fixed meanings across the entire Internet:

Address / BlockNameMeaning & Allowed Use
0.0.0.0This 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.255Limited broadcastDestination 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 broadcastDestination 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)LoopbackTests the networking software on the same host. Packet never leaves the host or touches any link!
224.0.0.0 – 239.255.255.255Class D MulticastDestination IP only: delivers to a group of subscribed hosts. Never a valid source IP.
Special IPv4 addresses tested repeatedly in GATE.

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

Class A (50%)0–127
Class B (25%)128–191
Class C (12.5%)192–223
D (6.25%)224–239
E (6.25%)240–255
0255
First-octet map of the 2³² IPv4 space: each class halves the remaining space.

Worked Examples

Easy

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.

Medium

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).

GATE

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.255 stops at the first router (local LAN only); 172.16.255.255 (Class B directed broadcast) can be routed to network 172.16.0.0 and 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

  1. MCQ

    To which IPv4 class does the address 191.255.10.1 belong, and what is its default mask?

    1. Class A, 255.0.0.0
    2. Class B, 255.255.0.0
    3. Class C, 255.255.255.0
    4. Class D, no mask
  2. NAT

    In a standard Class C network, how many usable host addresses are available?

    Write your answer before opening the key.

  3. MSQ

    Which of the following IPv4 addresses can NEVER be used as the source IP address of a valid packet on a link?

    1. 224.0.1.10
    2. 255.255.255.255
    3. 192.168.1.0 (in a standard Class C network)
    4. 192.168.1.1 (in a standard Class C network)
  4. MCQ

    What fraction of the total IPv4 address space is occupied by Class C addresses?

    1. 1/2 (50%)
    2. 1/4 (25%)
    3. 1/8 (12.5%)
    4. 1/16 (6.25%)
  5. MCQ

    A host sends a packet to destination 127.15.20.1. What happens to the packet?

    1. It is broadcast on the local Ethernet.
    2. It is forwarded by the default router to network 127.
    3. It is looped back inside the sending host by the network layer and never transmitted on any link.
    4. 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

  1. 8 bits; decimal 0 to 255.
  2. FF:FF:FF:FF:FF:FF (all 48 bits set to 1).
  3. 128 + 64 + 32 = 224.

Self-test answers

  1. 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.
  2. 254 — Class C has 8 host bits → 2⁸ − 2 = 256 − 2 = 254 usable hosts.
  3. 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.
  4. 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.
  5. 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

  1. First-octet ranges for Classes A, B, C, D, E?
    Reveal answerA: 0–127, B: 128–191, C: 192–223, D: 224–239, E: 240–255.
  2. Why is the number of usable hosts 2ʰ − 2?
    Reveal answerHost-id all-0s is the network address; host-id all-1s is the directed broadcast address.
  3. Difference between 255.255.255.255 and a directed broadcast?
    Reveal answer255.255.255.255 (limited broadcast) stays on the local LAN and is never forwarded by routers; a directed broadcast targets a specific network.
  4. What happens to a packet sent to 127.0.0.1?
    Reveal answerIt 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.0 can only be a source. — GATE MSQs asking "Which of the following can never be a valid source/destination IP?"

Ready for the next idea?

Mark this item complete when you’ve finished reading and working through it.