2024年1月4日星期四

windows系统下使用netsh配置IPv6相关

  习惯了Linux下命令行配置网络的简洁,在windows系统下是不是感觉很别扭?下面分享几个方便的命令操作。

  • 释放地址
ipconfig /release "Local Area Connection 1"
  • 重新获取地址
ipconfig /renew "Local Area Connection 1"
  • 配置IPv6单播地址
netsh interface ipv6 add/del address "Local Area Connection 1" 2001::1
  • 配置IPv6任播地址
netsh interface ipv6 add address "Local Area Connection 1" 3ffe:320e:213:: anycast
netsh interface ipv6 del address "Local Area Connection 1" 3ffe:320e:1:213::
  • 显示IPv6地址
netsh interface ipv6 show address
  • 配置IPv6路由
netsh interface ipv6 add/del route 2001::/64 "Local Area Connection 2" 2001::2
  • 显示IPv6路由
netsh interface ipv6 show route
  • 禁用/启用网卡的IPv6
netsh interface ipv6 set interface "Local Area Connection 2" disable/enable
  • 配置系统遵守EUI-64规则,生成符合eui-64的Link-local地址(重启后生效)
netsh interface ipv6 set privacy state=disabled store=active
netsh interface ipv6 set privacy state=disabled store=persistent
netsh interface ipv6 set global randomizeidentifiers=disabled store=active
netsh interface ipv6 set global randomizeidentifiers=disabled store=persistent
  • 重启网卡(win7及以上系统生效)
netsh interface set interface "本地连接 2" disabled
netsh interface set interface "本地连接 2" enabled

帮助链接 接口 Internet 协议版本 6 (IPv6) 的 Netsh 命令