gpt4 book ai didi

networking - 为什么ip地址127.001路由到127.0.0.1,127.011路由到127.0.0.9?

转载 作者:行者123 更新时间:2023-12-03 19:04:16 27 4
gpt4 key购买 nike

通过一个意外的拼写错误,我意识到当您尝试访问 IP 地址时 127.0.01它将成功路由到 127.0.0.1 .
玩弄这个,我注意到似乎有某种翻译正在发生。一些例子:

  • 127.001 -> 127.0.0.1
  • 127.002 -> 127.0.0.2
  • 127.011 -> 127.0.0.9
  • 127.111 -> 127.0.0.111
  • 127.1111 -> 127.0.4.87
  • 127.9999 -> 127.0.39.15

  • 这些翻译背后的逻辑是什么?我已经在 MacOS、Linux 和 Windows 上尝试并复制了它。

    最佳答案

    来自 wikipedia :

    When fewer than four numbers are specified in the address in dotted notation, the last value is treated as an integer of as many bytes as are required to fill out the address to four octets. Thus, the address 127.65530 is equivalent to 127.0.255.250.


    您可以自己进行计算以进行检查。
    例子: 127.9999 = 01111111 . 00000000 00100111 00001111= 127 . 0 . 39 . 15

    关于networking - 为什么ip地址127.001路由到127.0.0.1,127.011路由到127.0.0.9?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64067046/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com