最近遇到个问题,那就是win下的anyconnect无法获取用ocserv搭建服务的IPv6地址。
很是纳闷,在服务器端debug了下看到分配给客户端IPv6的地址了,但是客户端anyconnect就是无法获取,如下图。我用ocserv的openconnect客户端就能获取到地址。
查询各方资料无法找到解决方案。无意中在官方的changelog中找到一段话。
ocserv: reworked the MTU discovery. Disable MTU discovery when not requested and set the minimum packet size to 1280 for IPv6 and 800 bytes for IPv4. When the MTU discovery fails to calculate an MTU over the minimum then disable MTU discovery and rely on packet fragmentation. Also set the DPD packet size to equal the current MTU, to allow detecting broken DTLS connections.
链接地址:https://ocserv.gitlab.io/www/changelog.html
大概看了下,意思就是说MTU小于1280的话就不给IPv6地址。
随即我就查看了电脑的网卡的MTU,如下:
网卡的MTU才1300,anyconnect网卡启用的MTU才1206。这当然获取不了IPv6地址。
知道原因后着手将网卡的MTU改成默认的1500。电脑重启,如下:
再次使用Anyconnect连接ocserv正常获取IPv6地址。
问题解决啦。
后来我想了下,造成电脑MTU变成1300的原因是安装了思科的VPN客户端(RemoteVPN使用的客户端)。卸载或者使用自带的MTU设置工具设置成默认的即可恢复。
文章评论