IPv6 Compression review w/answer key
IPv6 compression allows us to represent lengthy IPv6 address in a more compact form by omitting leadings zeroes within each block and using a double colon (::) to represent consecutive zeros.
Leading Zero Compression
Leading zeros within each 16-bit block can be omitted
Example: 2001:0db8:0000:0042:0000:8a2e:0370:7334
compressed: 2001: db8: 0: 42: 0:8a2e: 370:7334
Consecutive Block Compression
Consecutive 16-bit blocks of all zeros, can be replaced with a double colon ::
Only use this once per address
Example: 2001:0db8:0000:0000:0000:0000:0000:7334
compressed 2001: db8: :7334
Examples to practice with
Test your knowledge by compressing the following IPv6 address:
Example: 2001:0db8:0000:0000:0000:0000:1428:57ab
Example: fe80:0000:57ab:0000:1c4a:0f7c:abcd:1234 /
Example: 3a00:0f80:0000:0000:0000:5a1b:0023:fa01
Example: 2001:0da8:0000:0000:0000:0000:0b12:0456
Example: 1234:5678:0000:0000:0db8:0000:0000:abcd
Answer Key
Example: 2001:0db8:0000:0000:0000:0000:1428:57ab compressed 2001: db8: :1428:57ab/
Example: fe80:0000:57ab:0000:1c4a:0f7c:abcd:1234 compressed fe80: 0:57ab: 0:1c4a: f7c:abcd:1234/
Example: 3a00:0f80:0000:0000:0000:5a1b:0023:fa01 compressed 3a00: f80: :5a1b: 23:fa01/
Example: 2001:0da8:0000:0000:0000:0000:0b12:0456 compressed 2001: da8: : b12: 456/
Example: 1234:5678:0000:0000:0db8:0000:0000:abcd compressed 1234:5678: : db8: 0: 0:abcd
In example 5 we are only able to use consecutive block compression one time but can still omit leading zeros in the other consecutive 16-bit blocks of all zeros