Exercises — IPv6 — address format, why needed, key differences
Reminders re-anchored (so line one already makes sense):
- A bit is one on/off choice (0 or 1).
- An IPv6 address is 128 bits, written as 8 groups (hextets) of 4 hexadecimal digits, separated by colons. One hex digit = 4 bits, because (see Hexadecimal and Binary Number Systems).
- Compression rule 1: drop leading zeros in each group.
- Compression rule 2: replace one run of consecutive all-zero groups with
::, used at most once.

Level 1 — Recognition
L1·Q1 — Count the bits
An IPv6 address has 8 hextets, and each hextet is 4 hexadecimal digits. Using "1 hex digit = 4 bits", how many bits is the whole address?
Recall Solution
WHAT: multiply digits by bits-per-digit. WHY: each hex digit stands for exactly 4 bits (), so counting digits then multiplying by 4 gives bits. Answer: 128 bits.
L1·Q2 — Count the addresses
How many distinct IPv6 addresses exist, and roughly how big is that number in powers of ten?
Recall Solution
WHY : 128 independent on/off choices give combinations (multiplication principle: 2 options per bit, 128 bits). Answer: addresses.
L1·Q3 — Spot the loopback
Which of these is the IPv6 loopback address? ::, ::1, fe80::1, 2001:db8::1
Recall Solution
Loopback = "talk to myself", the address 0000:0000:0000:0000:0000:0000:0000:0001. All 7 leading hextets are zero → collapse with ::, last hextet 0001 drops leading zeros to 1.
Answer: ::1. (:: alone is the all-zeros unspecified address, not loopback.)
Level 2 — Application
L2·Q1 — Drop leading zeros only
Apply only the leading-zero rule (no :: yet) to:
2001:0db8:0000:0042:0000:8a2e:0370:7334
Recall Solution
Go hextet by hextet, remove zeros on the left of each group; a group of all zeros becomes a single 0.
2001→20010db8→db80000→00042→420000→08a2e→8a2e0370→3707334→7334Answer:2001:db8:0:42:0:8a2e:370:7334.
L2·Q2 — Full compression
Now fully compress (both rules):
fe80:0000:0000:0000:0204:61ff:fe9d:f156
Recall Solution
Step 1 (leading zeros): fe80:0:0:0:204:61ff:fe9d:f156.
Step 2 (::): hextets 2,3,4 are all zero — a single run of length 3. Replace that run with ::.
Answer: fe80::204:61ff:fe9d:f156.
This fe80::/10 is a link-local address (auto-assigned, not routable — see DHCP and SLAAC).
L2·Q3 — Expand back out
Expand 2001:db8::1 to its full 8-hextet, 4-digit-per-group form.
Recall Solution
:: means "insert enough all-zero hextets to reach 8 groups". We currently see 2001, db8, and 1 = 3 non-zero hextets, so the gap holds zero hextets, placed where the :: sits.
Then pad each group to 4 digits.
Answer: 2001:0db8:0000:0000:0000:0000:0000:0001.
Level 3 — Analysis
L3·Q1 — Two zero-runs, pick one
Compress 2001:0db8:0000:0000:00ab:0000:0000:1234 correctly.
Recall Solution
Leading zeros first: 2001:db8:0:0:ab:0:0:1234.
Find zero-runs: run A = hextets 3–4 (length 2); run B = hextets 6–7 (length 2). A tie.
Rule: :: may appear only once. On a tie, compress the first longest run; write the other explicitly.
Answer: 2001:db8::ab:0:0:1234.
2001:db8::ab::1234 is illegal (two :: → the parser can't split the zeros between the gaps).
L3·Q2 — Unequal runs
Compress ff02:0000:0000:0000:0000:0000:0000:0001.
Recall Solution
Leading zeros: ff02:0:0:0:0:0:0:1.
Zero-runs: hextets 2–7, one run of length 6 (the longest possible non-trivial run here).
Collapse all six with ::.
Answer: ff02::1.
(This is the "all-nodes" multicast group — see Multicast vs Broadcast vs Anycast. IPv6 uses this instead of IPv4 broadcast.)
L3·Q3 — Spot the illegal one
Which addresses are illegal, and why?
(a) 2001::25de::cade (b) :: (c) 2001:db8:0:0:0:0:0:0 (d) 12345::1
Recall Solution
- (a) Illegal — two
::. Ambiguous: the parser can't tell how many zero-hextets go in each gap. - (b) Legal — the unspecified address, all 128 bits zero.
- (c) Legal but not fully compressed — those six trailing zeros should be
::, giving2001:db8::. It's valid, just not the canonical short form. - (d) Illegal —
12345is 5 hex digits; a hextet is at most 4 hex digits (16 bits, maxffff). Answer: (a) and (d) are illegal.
Level 4 — Synthesis
L4·Q1 — Build a prefix/interface split
An interface has network prefix 2001:db8:acad:1::/64 and interface ID 0000:0000:0000:00ff. Write the full compressed unicast address.
Recall Solution
WHAT the /64 means: the first 64 bits (4 hextets) are the network prefix; the last 64 bits (4 hextets) are the interface ID (see Subnetting).
- Prefix hextets:
2001 : db8 : acad : 1 - Interface hextets:
0000 : 0000 : 0000 : 00ff→0 : 0 : 0 : ffJoin:2001:db8:acad:1:0:0:0:ff. Compress: the three zero hextets (positions 5–7) form the longest run →::. Answer:2001:db8:acad:1::ff.
L4·Q2 — Ratio over IPv4
Show, with algebra, how many times larger the IPv6 space is than the IPv4 space, and give a decimal estimate.
Recall Solution
IPv4 has addresses, IPv6 has . Divide: WHY subtract exponents: dividing equal bases subtracts powers (). Answer: times larger.
L4·Q3 — Header-size arithmetic
IPv6's main header is a fixed 40 bytes. If you send 1000 tiny packets each carrying 8 bytes of data, what fraction of the total transmitted bytes is header overhead (ignore lower layers)? Give a percentage.
Recall Solution
Per packet: header B, data B, total B. Overhead fraction . Multiplying every packet by 1000 doesn't change the ratio. Answer: of bytes are header. (This is why the fixed header and extension-header design aim to keep the base header lean — see IP Header Structure.)
Level 5 — Mastery
L5·Q1 — Round-trip identity
Start with 2001:0db8:0000:0000:abcd:0000:0000:1234. Compress it, then expand the compressed form back. Confirm you land on the same 128-bit value (write it as full 8×4 digits).
Recall Solution
Compress: leading zeros → 2001:db8:0:0:abcd:0:0:1234. Two zero-runs of length 2 (hextets 3–4 and 6–7); tie → compress the first: 2001:db8::abcd:0:0:1234.
Expand back: :: must supply zero hextets between db8 and abcd:
2001:db8:0000:0000:abcd:0000:0000:1234.
Check: identical to the start. The two zero-hextets in positions 6–7 stayed explicit throughout — good. ✔
Answer: the round trip is lossless; full form 2001:0db8:0000:0000:abcd:0000:0000:1234.
L5·Q2 — Mixed reasoning: broadcast vs multicast
IPv4 broadcasts to 255.255.255.255 to reach every host on a link. IPv6 has no broadcast. To reach every node on a link IPv6 uses ff02::1. In one line each, state (a) how many hosts a broadcast disturbs vs a targeted multicast group, and (b) why removing broadcast reduces "storms".
Recall Solution
- (a) Broadcast wakes all N hosts on the link; a targeted multicast (e.g. a routers-only group
ff02::2) wakes only the subscribed subset (often far fewer).ff02::1still reaches all, but most IPv6 traffic uses narrow groups. - (b) Fewer interrupted hosts ⇒ fewer CPUs waking to process irrelevant frames ⇒ no cascading "everyone answers everyone" storms. Answer: broadcast = all N; targeted multicast = subscribers only; narrowing the audience removes the storm. (See Multicast vs Broadcast vs Anycast.)
L5·Q3 — Full compression under pressure
Compress 0000:0000:0000:0000:0000:0000:0000:0000 and also 2001:0db8:0000:0000:0000:0000:0000:0000. Explain the difference in where :: lands.
Recall Solution
- All zeros → single run of 8 zero-hextets → collapses entirely to
::(the unspecified address). - Second: leading zeros give
2001:db8:0:0:0:0:0:0; hextets 3–8 are one run of length 6 → collapse the trailing run:2001:db8::. The::sits at the end because that's where the zero-run is. Answer:::and2001:db8::. Lesson:::can sit at the start, middle, or end — wherever the longest zero-run actually is.
Connections
- 4.3.11 IPv6 — address format, why needed, key differences (Hinglish)
- IPv4 Addressing & CIDR
- Subnetting
- NAT (Network Address Translation)
- DHCP and SLAAC
- Multicast vs Broadcast vs Anycast
- IP Header Structure
- Hexadecimal and Binary Number Systems
- OSI & TCP-IP Model — Network Layer