cvm配置ipv6后,不能被以ipv6访问或不能访问ipv6站点

2021-12-28 14:26:25 浏览数 (1)

结论先行:默认开checksum offload可能会影响web访问异常

https://docs.microsoft.com/en-us/powershell/module/netadapter/set-netadapterchecksumoffload

5个参数就是Get-NetAdapterChecksumOffload -Name "*" 结果标题里那5个

-TcpIPv6Enabled

-UdpIPv6Enabled

-IpIPv4Enabled

-TcpIPv4Enabled

-UdpIPv4Enabled

从开启到关闭会断网三五秒,从关闭到开启也一样

开启的参数值RxTxEnabled

关闭的参数值Disabled

#关闭ChecksumOffload

Set-NetAdapterChecksumOffload -Name "*" -TcpIPv6Enabled Disabled -UdpIPv6Enabled Disabled -IpIPv4Enabled Disabled -TcpIPv4Enabled Disabled -UdpIPv4Enabled Disabled

#开启ChecksumOffload

Set-NetAdapterChecksumOffload -Name "*" -TcpIPv6Enabled RxTxEnabled -UdpIPv6Enabled RxTxEnabled -IpIPv4Enabled RxTxEnabled -TcpIPv4Enabled RxTxEnabled -UdpIPv4Enabled RxTxEnabled

配置了ipv6不通,大概率是没在控制台绑定ipv6 eip

https://cloud.tencent.com/document/product/1142/47667 官网文档最开始就有提醒

绑定ipv6 eip了,其他配置也参考官网文档配了,服务器不能访问ipv6网站或不能被客户端以ipv6地址访问,ipv4地址则正常,这种情况可以试试关闭Checksum Offload (IPv6)

默认是Enabled

网卡调参数:运行ncpa.cpl打开本地连接属性 → 配置 → 高级页签里找到TCP和UDP Checksum Offload (IPv6) → 默认的Enabled切换到Disabled

Checksum Offload项比较多,我们只关闭TCP Checksum Offload (IPv6)和UDP Checksum Offload (IPv6)

有几个相关的powershell命令

  • Get-NetAdapterChecksumOffload
  • Set-NetAdapterChecksumOffload
  • Enable-NetAdapterChecksumOffload
  • Disable-NetAdapterChecksumOffload

以上4个命令中,Get-NetAdapterChecksumOffload 之外的三个命令都是"写"命令,都有个参数-NoRestart

按这个参数的官网解释,一些高级参数需要重启生效,使用写命令后最好重启下机器

实测下来,发现不加-NoRestart会自动重启网络,加了-NoRestart不会自动重启网络,可能需要手动禁用、启用网卡或者重启机器

关闭TCP Checksum Offload (IPv6)和UDP Checksum Offload (IPv6)

不加-NoRestart

Disable-NetAdapterChecksumOffload -Name "*" -TcpIPv6 -UdpIPv6

Disable-NetAdapterChecksumOffload -Name "MyAdapter" -TcpIPv6 -UdpIPv6

-NoRestart

Disable-NetAdapterChecksumOffload -Name "*" -TcpIPv6 -UdpIPv6 -NoRestart

Disable-NetAdapterChecksumOffload -Name "MyAdapter" -TcpIPv6 -UdpIPv6 -NoRestart

不加-NoRestart

Set-NetAdapterChecksumOffload -Name "*" -TcpIPv6Enabled Disabled -UdpIPv6Enabled Disabled

Set-NetAdapterChecksumOffload -Name "MyAdapter" -TcpIPv6Enabled Disabled -UdpIPv6Enabled Disabled

-NoRestart

Set-NetAdapterChecksumOffload -Name "*" -TcpIPv6Enabled Disabled -UdpIPv6Enabled Disabled -NoRestart

Set-NetAdapterChecksumOffload -Name "MyAdapter" -TcpIPv6Enabled Disabled -UdpIPv6Enabled Disabled -NoRestart

开启TCP Checksum Offload (IPv6)和UDP Checksum Offload (IPv6)

不加-NoRestart

Set-NetAdapterChecksumOffload -Name "*" -TcpIPv6Enabled RxTxEnabled -UdpIPv6Enabled RxTxEnabled

Set-NetAdapterChecksumOffload -Name "MyAdapter" -TcpIPv6Enabled RxTxEnabled -UdpIPv6Enabled RxTxEnabled

-NoRestart

Set-NetAdapterChecksumOffload -Name "*" -TcpIPv6Enabled RxTxEnabled -UdpIPv6Enabled RxTxEnabled -NoRestart

Set-NetAdapterChecksumOffload -Name "MyAdapter" -TcpIPv6Enabled RxTxEnabled -UdpIPv6Enabled RxTxEnabled -NoRestart

注意:命令里的"MyAdapter"要具体化成ncpa.cpl显示的网卡名称,比如上面实例中是"以太网"

参考

https://docs.microsoft.com/en-us/powershell/module/netadapter/disable-netadapterchecksumoffload

https://docs.microsoft.com/en-us/powershell/module/netadapter/set-netadapterchecksumoffload

0 人点赞