首页 > 解决方案 > Get-NetIPAddress 返回 ipconfig 中未找到的值

问题描述

我们正在对系统中的服务器进行配置清单,并发现了一些奇怪的东西。我们的两台服务器共享此异常:当我们运行 PowerShell Get-NetIPAddress 时,如下所示:

Get-NetIPAddress -addressstate Preferred -addressfamily ipv4

返回三个 IP 地址。它们是 192.xxx、127.0.0.1 和 169.xxx 据报道,在这两种情况下,169 地址都在接口别名本地连接11上* IP 地址彼此不同,但都在 169.254.0.0/16网络(16 位掩码)。

但是,这两个服务器的“ipconfig /all”根本不显示 169 地址。

控制面板/网络和 Internet/网络连接除了 192.168.xx 的接口外也没有显示任何内容

我在哪里可以确定 Get-NetIPAddress 从何处获取此信息?

PS C:\Windows\system32> Get-NetIPAddress -addressstate Preferred -addressfamily ipv4


IPAddress         : 192.168.10.xxx
InterfaceIndex    : 13
InterfaceAlias    : Ethernet 2
AddressFamily     : IPv4
Type              : Unicast
PrefixLength      : 24
PrefixOrigin      : Manual
SuffixOrigin      : Manual
AddressState      : Preferred
ValidLifetime     : Infinite ([TimeSpan]::MaxValue)
PreferredLifetime : Infinite ([TimeSpan]::MaxValue)
SkipAsSource      : False
PolicyStore       : ActiveStore

**IPAddress         : 169.254.xxx.xxx
InterfaceIndex    : 14
InterfaceAlias    : Local Area Connection* 11
AddressFamily     : IPv4
Type              : Unicast
PrefixLength      : 16
PrefixOrigin      : WellKnown
SuffixOrigin      : Link
AddressState      : Preferred
ValidLifetime     : Infinite ([TimeSpan]::MaxValue)
PreferredLifetime : Infinite ([TimeSpan]::MaxValue)
SkipAsSource      : False
PolicyStore       : ActiveStore**

IPAddress         : 127.0.0.1
InterfaceIndex    : 1
InterfaceAlias    : Loopback Pseudo-Interface 1
AddressFamily     : IPv4
Type              : Unicast
PrefixLength      : 8
PrefixOrigin      : WellKnown
SuffixOrigin      : WellKnown
AddressState      : Preferred
ValidLifetime     : Infinite ([TimeSpan]::MaxValue)
PreferredLifetime : Infinite ([TimeSpan]::MaxValue)
SkipAsSource      : False
PolicyStore       : ActiveStore

PS C:\Windows\system32> 
PS C:\Windows\system32> ipconfig /all

Windows IP Configuration

   Host Name . . . . . . . . . . . . : GotDomVM1
   Primary Dns Suffix  . . . . . . . : gotnet.net
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No
   DNS Suffix Search List. . . . . . : gotnet.net

Tunnel adapter Local Area Connection* 11:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . : 
   Description . . . . . . . . . . . : Microsoft Failover Cluster Virtual Adapter
   Physical Address. . . . . . . . . : 02-87-4F-xx-xx-xx
   DHCP Enabled. . . . . . . . . . . : Yes
   Autoconfiguration Enabled . . . . : Yes

Ethernet adapter Ethernet 2:

   Connection-specific DNS Suffix  . : 
   Description . . . . . . . . . . . : Microsoft Hyper-V Network Adapter
   Physical Address. . . . . . . . . : 00-15-5D-xx-xx-xx
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::b074:d74d:6320:dab0%13(Preferred) 
   IPv4 Address. . . . . . . . . . . : 192.168.10.xxx(Preferred) 
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.10.xxx
   DHCPv6 IAID . . . . . . . . . . . : 251663709
   DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-25-F9-6D-6F-00-15-xx-xx-xx-xx
   DNS Servers . . . . . . . . . . . : ::1
                                       192.168.10.x
                                       192.168.10.y
                                       127.0.0.1
   NetBIOS over Tcpip. . . . . . . . : Enabled

Tunnel adapter isatap.{6D49450E-C01F-4FF3-9CF8-033D67921AA6}:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . : 
   Description . . . . . . . . . . . : Microsoft ISATAP Adapter
   Physical Address. . . . . . . . . : 00-00-00-00-xx-xx-xx-xx
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes

Tunnel adapter isatap.{2B8A29E1-13B1-4311-A1F7-6CDBA190EC28}:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . : 
   Description . . . . . . . . . . . : Microsoft ISATAP Adapter #2
   Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes

PS C:\Windows\system32> 

谢谢,丹尼斯

标签: powershellipconfigwindows-networking

解决方案


至于为什么它有一个 169 地址:

什么是 Microsoft 故障转移群集虚拟适配器?

与其他适配器一样,Microsoft 故障转移群集虚拟适配器具有 MAC 地址以及分配给它的 IPv4 和 IPv6 地址。IPv4 地址是自动私有 Internet 协议寻址 (APIPA) 地址

但是为什么它没有显示使用ipconfig /all?可能是因为断线了。它仍然分配了一个 IP 地址,所以Get-NetIPAddress可以看到,但 ipconfig 并不真正关心非活动 IP。链接的 MS 博客特别显示它与 ipconfig 一起正常工作:

当使用 ipconfig /all 命令行列出集群节点的网络配置时,它是显而易见的。

在此处输入图像描述


推荐阅读