查看 Windows 接口 IP 设置与跃点数(Get-NetIPInterface)

查看每个接口的 DHCP 状态、自动跃点数和 MTU——理解流量为什么走某张网卡的关键一环。

Windows路由网络PowerShell低风险
运行 Get-NetIPInterface -AddressFamily IPv4 即可列出每个接口的 DHCP 状态、跃点数和连接状态。

01命令

命令
$ Get-NetIPInterface -AddressFamily IPv4 | Sort-Object InterfaceMetric | Format-Table InterfaceAlias,InterfaceMetric,Dhcp,ConnectionState -AutoSize

02作用说明

Windows 按 InterfaceMetric 数值最低来选择处理流量的网卡,而 Get-NetIPInterface 正是那个常被遗忘、能直接显示这些数值的 cmdlet——排查 VPN 抢占默认路由时特别有用。配套的 Set-NetIPInterface 可以调整 -InterfaceMetric 或按接口关闭路由器发现。它也是 'netsh interface ipv4 show interfaces' 的现代替代品。

03风险

风险低风险

04撤销

✓无需撤销——该命令不会改变持久状态。

05来源

  • Get-NetIPInterface | Microsoft Learn
    Microsoft · vendor-doc · 2026-09-17
    依据: Microsoft documents Get-NetIPInterface as retrieving IP interface properties including InterfaceMetric, Dhcp, NeighborDiscovery and MTU settings.

最后验证: 2026-09-17 · 分类: 网络

06相关方案