解释 System.Net.IPAddress 的实例属性

发布于 2024-11-16 16:16:50 字数 367 浏览 4 评论 0原文

我在理解 System.Net 时遇到了一些困难.IPAddress class,因为我不知道在哪里查找某些属性所指的定义。具体来说,是什么:

 IPAddress.IsIPv6LinkLocal
 IPAddress.IsIPv6Multicast
 IPAddress.IsIPv6SiteLocal
 IPAddress.IsIPv6Teredo

我也很乐意接受指向解释这些概念的资源的答案。 MSDN 站点已被证明是不够的。

I'm having a little trouble understanding the System.Net.IPAddress class, because I don't know where to look for a definition of what some of the properties are referring to. Specifically, what are:

 IPAddress.IsIPv6LinkLocal
 IPAddress.IsIPv6Multicast
 IPAddress.IsIPv6SiteLocal
 IPAddress.IsIPv6Teredo

I will also happily accept an answer that points to a resource that explains these concepts. The MSDN site has proved insufficient.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

眼眸里的快感 2024-11-23 16:16:50

IPAddress.IsIPv6LinkLocal

链路本地地址是一个IP地址
其目的仅在于
本地内部通讯
子网。路由器不转发
具有链路本地地址的数据包。

IPAddress.IsIPv6Multicast

多播地址是一个逻辑地址
一组主机的标识符
可用的计算机网络
处理数据报或帧
旨在多播
指定网络服务。组播
可以在链接中使用寻址
层(OSI 模型中的第 2 层),例如
作为以太网多播,并且在
互联网层(OSI 第 3 层)
互联网协议版本 4 (IPv4) 或
版本 6 (IPv6) 多播。

IPAddress.IsIPv6SiteLocal

唯一的本地地址(ULA)是
块 fc00::/7 中的 IPv6 地址,
RFC 4193 中定义。它是 IPv6
IPv4私有协议的对应部分
地址。唯一的本地地址是
可用于专用网络,
例如在单个站点内或
组织或范围有限
站点或组织的数量。他们
在全局 IPv6 中不可路由
互联网。

IPAddress.IsIPv6Teredo

在计算机网络中,Teredo 是
过渡技术,充分
支持 IPv6 的 IPv6 连接
IPv4 Internet 上的主机
但没有直接的原生
连接到 IPv6 网络。
与其他类似协议相比
它的显着特点是
甚至能够执行其功能
从后面的网络地址
转换 (NAT) 设备,例如家用设备
路由器。

IPAddress.IsIPv6LinkLocal

A link-local address is an IP address
that is intended only for
communications within the local
subnetwork. Routers do not forward
packets with link-local addresses.

IPAddress.IsIPv6Multicast

A multicast address is a logical
identifier for a group of hosts in a
computer network, that are available
to process datagrams or frames
intended to be multicast for a
designated network service. Multicast
addressing can be used in the Link
Layer (Layer 2 in the OSI model), such
as Ethernet multicast, and at the
Internet Layer (Layer 3 for OSI) for
Internet Protocol Version 4 (IPv4) or
Version 6 (IPv6) multicast.

IPAddress.IsIPv6SiteLocal

A unique local address (ULA) is an
IPv6 address in the block fc00::/7,
defined in RFC 4193. It is the IPv6
counterpart of the IPv4 private
address. Unique local addresses are
available for use in private networks,
e.g. inside a single site or
organisation, or spanning a limited
number of sites or organisations. They
are not routable in the global IPv6
Internet.

IPAddress.IsIPv6Teredo

In computer networking, Teredo is a
transition technology that gives full
IPv6 connectivity for IPv6-capable
hosts which are on the IPv4 Internet
but which have no direct native
connection to an IPv6 network.
Compared to other similar protocols
its distinguishing feature is that it
is able to perform its function even
from behind network address
translation (NAT) devices such as home
routers.

思念满溢 2024-11-23 16:16:50

CodeNaked的答案几乎是正确的,但请注意IPAddress.IsIPv6SiteLocal。原始 IPv6 站点本地地址 (fec0::/10) 已弃用。

如今,使用唯一本地地址 (ULA) 来代替站点本地地址。 ULA 有两个变体: fc00::/8 尚未定义,但将来可能用于在中心位置(ULA Central)注册的内部使用地址。 fd00::/8 正在使用中,无需在任何地方注册。该范围内的前缀是随机生成的。

不幸的是 IsIPv6SiteLocal 仅检查原始已弃用的版本:

PS C:\Users\Administrator> [System.Net.IPAddress]'fec0::'

Address           :
AddressFamily     : InterNetworkV6
ScopeId           : 0
IsIPv6Multicast   : False
IsIPv6LinkLocal   : False
IsIPv6SiteLocal   : True
IPAddressToString : fec0::

它无法识别 ULA Central:

PS C:\Users\Administrator> [System.Net.IPAddress]'fc00::'

Address           :
AddressFamily     : InterNetworkV6
ScopeId           : 0
IsIPv6Multicast   : False
IsIPv6LinkLocal   : False
IsIPv6SiteLocal   : False
IPAddressToString : fc00::

或本地分配的 ULA:

PS C:\Users\Administrator> [System.Net.IPAddress]'fd00::'

Address           :
AddressFamily     : InterNetworkV6
ScopeId           : 0
IsIPv6Multicast   : False
IsIPv6LinkLocal   : False
IsIPv6SiteLocal   : False
IPAddressToString : fd00::

请参阅 https://www.rfc-editor.org/rfc/rfc4193 了解更多详情。

The answer of CodeNaked is almost correct, but please watch out with IPAddress.IsIPv6SiteLocal. The original IPv6 Site Local addresses (fec0::/10) are deprecated.

These days Unique Local Addresses (ULA) are used in place of Site Local. ULA has two variants: fc00::/8 is not defined yet, but might be used in the future for internal-use addresses that are registered in a central place (ULA Central). fd00::/8 is in use and does not have to registered anywhere. Prefixes from this range are generated randomly.

Unfortunately IsIPv6SiteLocal only checks for the original deprecated version:

PS C:\Users\Administrator> [System.Net.IPAddress]'fec0::'

Address           :
AddressFamily     : InterNetworkV6
ScopeId           : 0
IsIPv6Multicast   : False
IsIPv6LinkLocal   : False
IsIPv6SiteLocal   : True
IPAddressToString : fec0::

It does not recognize ULA Central:

PS C:\Users\Administrator> [System.Net.IPAddress]'fc00::'

Address           :
AddressFamily     : InterNetworkV6
ScopeId           : 0
IsIPv6Multicast   : False
IsIPv6LinkLocal   : False
IsIPv6SiteLocal   : False
IPAddressToString : fc00::

Or locally assigned ULA:

PS C:\Users\Administrator> [System.Net.IPAddress]'fd00::'

Address           :
AddressFamily     : InterNetworkV6
ScopeId           : 0
IsIPv6Multicast   : False
IsIPv6LinkLocal   : False
IsIPv6SiteLocal   : False
IPAddressToString : fd00::

Please see https://www.rfc-editor.org/rfc/rfc4193 for further details.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文