Recall warm-up
- Does a switch divide a collision domain, a broadcast domain, or both?
Stuck? Peek at 2.4.2 Ethernet efficiency; switched vs shared Ethernet
- Shared Ethernet efficiency η = 1/(1 + 5a) (course default); variants 1/(1 + 5.44a), 1/(1 + 6.44a).
- Switched full-duplex: no collisions, no CSMA/CD, full rate per link.
- Collision domains: hub = 1; switch/router = 1 per interface.
- Broadcast domains: only routers split them.
- After the 3rd collision in binary exponential backoff, how many slot choices exist?
Stuck? Peek at 2.3.4 Binary exponential backoff; probability of winning
- After the n-th collision: K uniform in {0, …, 2^min(n,10) − 1}; wait K × slot; abort after 16.
- Slot = 512 bit times (51.2 µs at 10 Mbps).
- P(A wins) = #{K_A < K_B} / (a·b); both at range 2: win 1/4, tie 1/2.
- Capture: A at range 2 vs B at range 4 → A wins 5/8.
- Which layer adds a logical address that identifies the final destination host across networks?
Stuck? Peek at 1.1.3 Encapsulation, headers, PDU names, addresses and devices per layer
- Encapsulation: payload + header (+ trailer at data link); decapsulation in reverse.
- PDUs: message (app) → segment (transport) → packet/datagram (network) → frame (data link) → bits.
- Addresses: link (per hop, changes) · network (end to end, fixed) · which-program id · names.
- Devices: hub/repeater 1 · bridge/switch 2 · router 3 · gateway/host up to 7.
- Efficiency = data / (data + all headers + trailer).
The Hook
In Phase 2, a 48-bit MAC address got our frame across one local network. But MAC addresses are flat hardware serial numbers burned into cards at the factory — a laptop in Chennai and a laptop in Delhi could have almost identical MAC numbers. If every router in the world had to keep a list of all 10 billion MAC addresses on Earth, every router's memory would explode.
Phase 3 puts our message inside a network-layer envelope (a datagram) stamped with a hierarchical IPv4 address — like a postal PIN code where the first digits name the city and area, and the last digits name the house on that street.
Predict First
Why can post offices route a letter across the country by reading only the first 3 digits of a 6-digit PIN code, whereas they could never do that with a national citizen ID card number?
,Because a PIN code is hierarchical (grouped by location: state → district → post office), so distant sorting centres only need one table entry per region. A citizen ID is flat (assigned by birth/registration order, like a MAC address) and tells you nothing about where the person currently lives.
Core Concept
32 bits and the 2³² address space
An IPv4 address is a 32-bit binary number that uniquely and universally identifies a host's connection (interface) to a network.
Because a router connects two or more networks, a router has one IPv4 address per connected link (interface).
Dotted-decimal notation
Humans cannot read 32-bit binary strings without going cross-eyed, so we convert each 8-bit octet into its decimal value (0 to 255) and separate the four numbers with dots.
a.b.c.d where each octet satisfies 0 ≤ a, b, c, d ≤ 255, with no leading zeros.| Octet binary | Place-value sum | Decimal |
|---|---|---|
| 11000000 | 128 + 64 | 192 |
| 10101000 | 128 + 32 + 8 | 168 |
| 00000001 | 1 | 1 |
| 00001010 | 8 + 2 | 10 |
Two-level hierarchy: Net-ID + Host-ID
Every IPv4 address is divided into two contiguous parts:
- Network part (net-id) — the leftmost n bits. All hosts on the same LAN share the exact same net-id. Distant routers inspect only the net-id.
- Host part (host-id) — the remaining h = 32 − n rightmost bits. Identifies the specific interface inside that network.
Putting it together
- IPv4 addresses are 32-bit hierarchical identifiers written as four decimal octets (0–255).
- The left n bits (net-id) identify the network; the right 32−n bits (host-id) identify the interface on that network.
- Unlike flat 48-bit MAC addresses, hierarchical IPv4 addresses let routers route by looking only at the net-id.
Visual
Worked Examples
Which of these dotted-decimal strings are valid IPv4 addresses? (i) 192.168.1.256 (ii) 10.0.1 (iii) 11000000.00000000.00000010.00000001 in dotted decimal.
Show the full solution
(i) Invalid: 256 > 255 (needs 9 bits). (ii) Invalid: only 3 octets instead of 4. (iii) Binary octets are 192, 0, 2, 1 → valid address 192.0.2.1.
A network uses the leftmost 22 bits as its net-id. How many bits are in the host-id, and how many total IPv4 addresses exist in this network block?
Show the full solution
Host bits h = 32 − 22 = 10 bits. Total addresses in the block = 2¹⁰ = 1024.
Express the IPv4 address 172.16.25.10 as a single 32-bit hexadecimal number and as a 32-bit unsigned integer.
Show the full solution
Convert each octet to 2-digit hex: 172 = 10×16 + 12 = AC, 16 = 10, 25 = 1×16 + 9 = 19, 10 = 0A → hex is 0xAC10190A.
As a 32-bit unsigned integer: 172×2²⁴ + 16×2¹⁶ + 25×2⁸ + 10 = 2885681152 + 1048576 + 6400 + 10 = 2886736138.
GATE Traps
- An IPv4 address identifies a network interface, not a whole machine — a router with 3 links has 3 different IPv4 addresses.
- Each octet is 0 to 255 inclusive; 256 is NEVER valid in dotted-decimal.
- Do not confuse total addresses in a block (2ʰ) with usable host addresses (covered in 3.1.2–3.1.3).
Memory Hook
IPv4 = 4 bytes = 32 bits. Net-ID gets you to the street; Host-ID knocks on the door.
Connect the Dots
Every IPv4 address splits into n network bits and 32 − n host bits. Next question (3.1.2): When a router sees 192.168.1.10, how did the early Internet know where the net-id ended and the host-id began without any extra number attached?
Self-Test
- MCQ
How many bits and bytes long is an IPv4 address?
- 32 bits (4 bytes)
- 48 bits (6 bytes)
- 64 bits (8 bytes)
- 128 bits (16 bytes)
- MSQ
Which of the following are TRUE about IPv4 addresses?
- A router connecting three LANs has three distinct IPv4 addresses.
- All hosts on the same LAN share the same net-id.
- An octet in dotted-decimal can take values from 0 to 256.
- Total IPv4 address space is 2³².
- NAT
If the network part of an IPv4 address is 20 bits long, how many bits remain for the host part?
Write your answer before opening the key.
- MCQ
What is the dotted-decimal form of 10101100.00010000.00000100.00001001?
- 172.16.4.9
- 172.32.4.9
- 168.16.4.9
- 172.16.8.9
Rule Card
- 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).
Concept Ledger
- IP address
- IPv4 address (32 bits)
- octet
- dotted decimal
- network part (net-id)
- host part (host-id)
- address space 2³²
Answer Vault
Try the questions first. Open when you are ready to check.
Warm-up answers
- Each switch connection is its own collision domain, while the whole switched LAN remains a single broadcast domain.
- 2³ = 8 choices (0 through 7).
- The Network Layer (Layer 3), inside the packet/datagram header.
Self-test answers
- A — An IPv4 address has 4 octets × 8 bits = 32 bits = 4 bytes.
- B: 48 bits (6 bytes) is a MAC address.
- C: Not IPv4.
- D: 128 bits is IPv6.
- ABD — Each interface gets its own IP; hosts on a LAN share net-id; total space is 2³². Octet max is 255.
- C: 8 bits represent 0..255 (256 values total, max value 255).
- 12 — 32 − 20 = 12 bits.
- A — 10101100₂ = 128+32+8+4 = 172; 00010000₂ = 16; 00000100₂ = 4; 00001001₂ = 9.
- B: Second octet is 16, not 32.
- C: First octet is 172, not 168.
- D: Third octet is 4, not 8.
Flashcards
- Size of an IPv4 address vs MAC address?
Reveal answer
IPv4 = 32 bits (4 bytes, dotted decimal); MAC = 48 bits (6 bytes, hex). - What does an IPv4 address actually identify: a host or an interface?
Reveal answer
A network interface (a router with k links has k IPv4 addresses). - If net-id is n bits, how many addresses are in that network block?
Reveal answer
2³²⁻ⁿ addresses.
Exam shortcuts
- Fast octet binary memorize: 128, 192, 224, 240, 248, 252, 254, 255 are 1, 2, 3, 4, 5, 6, 7, 8 leading ones in an octet. — converting common network octets between binary and decimal in seconds.
- Block size from net-id bits: if net-id has n bits, total addresses in that network = 2³²⁻ⁿ. — any contiguous n-bit network prefix.