The shortest IPv6 addresses

The Shortest IPv6 Addresses / 最短的 IPv6 地址

I was looking for the shortest possible IPv6 equivalent of 1.1.1.1 (and its secondary 1.0.0.1, sometimes abbreviate 1.1).

我一直在寻找 1.1.1.1(及其备用地址 1.0.0.1,有时简写为 1.1)的最短 IPv6 等效地址。

Method / 方法

An IPv6 address is 128 bits long, written as 8 hexadecimal groups of 16bits. The :: shorthand replaces a run of zeros. The shortest addresses are therefore those where only the first group is non-zero: X::.

IPv6 地址长度为 128 位,写作 8 组 16 位的十六进制数。:: 缩写用于代替连续的零。因此,最短的地址就是那些只有第一组非零的地址:X::

Only the global unicast block 2000::/3 is actually usable. Every other block is reserved, unroutable, or too long to write out. Since we’re looking at the first 16-bit block, that leaves us with 13 variable bits. Not a lot, I can just scan through those!

只有全球单播地址块 2000::/3 是实际可用的。其他所有地址块要么被保留,要么不可路由,要么书写长度过长。由于我们关注的是第一个 16 位块,这留下了 13 个可变位。数量不多,我可以直接扫描一遍!

The script / 脚本

For any script with fewer than 3 control structures, I tend to default to my shell of choice, fish.

对于任何控制结构少于 3 个的脚本,我倾向于默认使用我最喜欢的 shell:fish。

for i in (seq 0 8192)
  set ip_num (math 8192 + $i)
  set current_ip (printf '%x::' $ip_num)
  if ping -6 $current_ip -c 1 -W 0.7 &>/dev/null
    echo $current_ip
  end
end | tee result_ipv6

The results / 结果

Only 4 IPs responded to my pings.

只有 4 个 IP 地址响应了我的 ping 请求。

AddressRIRWhoDNS?Avg. response time
2409::APNICIndian state government via the NKN✅ yes436ms
2600::ARINCogent (US-based ISP)❌ no173ms
2a09::RIPETom — for dns.sb✅ yes163ms
2a11::RIPETom — for dns.sb✅ yes161ms

After re-running the script from a non-residential IP, I got 3 additional results:

在从非住宅 IP 重新运行脚本后,我又得到了 3 个结果:

AddressRIRWho
2002::IANAI have no idea why I’m getting a response. It’s the 6to4 address corresponding to 0.0.0.0
2a12::RIPEThe info is a bit vague, but it’s apparently Van Veen Beheer B.V.
2c0f::AFRINICSatsoft CC, a South African telecommunications company
地址RIR归属
2002::IANA我不知道为什么会收到响应。这是对应于 0.0.0.0 的 6to4 地址。
2a12::RIPE信息有点模糊,但显然是 Van Veen Beheer B.V. 公司。
2c0f::AFRINICSatsoft CC,一家南非电信公司。

If you liked this article click on the heart! You can even send multiple hearts! The waiting time between two hearts doubles each time.

如果你喜欢这篇文章,请点击红心!你甚至可以发送多个红心!每次点击之间的等待时间会翻倍。