IP 地址 ======= .. versionadded:: @2012-04-20 创建, IPv6 local address .. versionchanged:: @2019-02-16 增加 IPv4, add more address from RFC 参考 :wiki:`IP address` IPv4 ---- :rfc:`6890`, (过时::rfc:`5735`\ ) ================== ========================== =========================== Address Block Present Use Reference ================== ========================== =========================== 0.0.0.0/8 "This" Network :rfc:`1122#section-3.2.1.3` 10.0.0.0/8 Private-Use Networks :rfc:`1918` 127.0.0.0/8 Loopback :rfc:`1122#section-3.2.1.3` 100.64.0.0/10 Shared Address Space :rfc:`6598` 169.254.0.0/16 Link Local :rfc:`3927` 172.16.0.0/12 Private-Use Networks :rfc:`1918` 192.0.0.0/24 IETF Protocol Assignments :rfc:`5736` 192.0.0.0/29 DS-Lite :rfc:`6333` 192.0.2.0/24 TEST-NET-1 :rfc:`5737` 192.88.99.0/24 6to4 Relay Anycast :rfc:`3068` 192.168.0.0/16 Private-Use Networks :rfc:`1918` 198.18.0.0/15 Network Interconnect Device Benchmark Testing :rfc:`2544` 198.51.100.0/24 TEST-NET-2 :rfc:`5737` 203.0.113.0/24 TEST-NET-3 :rfc:`5737` 224.0.0.0/4 Multicast :rfc:`3171` 240.0.0.0/4 Reserved for Future Use :rfc:`1112#section-4` 255.255.255.255/32 Limited Broadcast :rfc:`919#section-7` :rfc:`922#section-7` ================== ========================== =========================== * Private addresses * 10.0.0.0/8 (10.0.0.0 - 10.255.255.255) * 172.16.0.0/12 (172.16.0.0 – 172.31.255.255) * 192.168.0.0/16 (192.168.0.0 – 192.168.255.255) * Shared addresses * 100.64.0.0/10 #. However, Shared Address Space has limitations in its use that the current [:rfc:`1918`] private address space does not have. #. In particular, Shared Address Space can only be used in Service Provider networks or on routing equipment that is able to do address translation across router interfaces when the addresses are identical on two different interfaces. * Link local * 169.254.0.0/16 Allocated for communication between hosts on a single link. Hosts obtain these addresses by auto-configuration, such as when a DHCP server cannot be found. IPv6 ---- 连接测试网站: http://ipv6-test.com ================== ========================== =========================== Address Block Present Use Reference ================== ========================== =========================== ::1/128 Loopback Address :rfc:`4291` ::/128 Unspecified Address :rfc:`4291` 64:ff9b::/96 IPv4-IPv6 Translat :rfc:`6052` ::ffff:0:0/96 IPv4-mapped Address :rfc:`4291` 100::/64 Discard-Only Address Block :rfc:`6666` 2001::/23 IETF Protocol Assignments :rfc:`2928` 2001::/32 TEREDO :rfc:`4380` 2001:2::/48 Benchmarking :rfc:`5180` 2001:db8::/32 Documentation :rfc:`3849` 2001:10::/28 ORCHID (not after 201403) :rfc:`4843` 2002::/16 6to4 :rfc:`3056` fc00::/7 Unique-Local :rfc:`4193` fe80::/10 Linked-Scoped Unicast :rfc:`4291` ================== ========================== =========================== The Local IPv6 addresses are created using a pseudo-randomly allocated global ID. They have the following format: :: | 7 bits |1| 40 bits | 16 bits | 64 bits | +--------+-+------------+-----------+----------------------------+ | Prefix |L| Global ID | Subnet ID | Interface ID | +--------+-+------------+-----------+----------------------------+ Where: Prefix FC00::/7 prefix to identify Local IPv6 unicast addresses. L Set to 1 if the prefix is locally assigned. Set to 0 may be defined in the future. See Section 3.2 for additional information. Global ID 40-bit global identifier used to create a globally unique prefix. See Section 3.2 for additional information. Subnet ID 16-bit Subnet ID is an identifier of a subnet within the site. Interface ID 64-bit Interface ID as defined in [ADDARCH]. Use following program to generate *Locally Assigned Global ID*. .. literalinclude:: createLULA.py :language: python :linenos: