What is the difference between IPv4 and IPv6, and how do you shorten an IPv6 address?
IPv4 uses 32-bit addresses (about 4.3 billion), IPv6 uses 128-bit addresses (about 3.4 x 10^38). IPv6 is written as eight hex groups; you may drop leading zeros in each group and replace one run of all-zero groups with ::.
Explain it simply
IPv4 is like a six-digit PIN code system that ran out of codes. IPv6 is a much longer postal code system with so many combinations that every device can have a public address of its own.
Example
IPv4 203.0.113.7 32 bits, decimal, 4 octets
IPv6 2001:0db8:0000:0000:0000:ff00:0042:8329 128 bits, hex, 8 groups
Shorten:
1. drop leading zeros: 2001:db8:0:0:0:ff00:42:8329
2. replace one run of zero groups with :: -> 2001:db8::ff00:42:8329
:: may appear only once, otherwise the length would be ambiguous.
::1 is loopback (like 127.0.0.1).Other differences: IPv6 has no broadcast, headers are simpler (fixed 40 bytes), routers never fragment, and devices can configure addresses automatically (SLAAC). NAT is rarely needed, because there are enough addresses. Both are in use together (dual stack), and many Indian mobile networks already use IPv6 widely.
What to say in the interview
"IPv6 solves address exhaustion with 128-bit addresses. It also removes broadcast, simplifies headers and supports auto-configuration. To shorten an address, drop leading zeros and collapse the longest run of zero groups with one double colon."
Common mistakes
- Using :: twice in one address.