Windows和Virtualbox端口号映射失败怎么办?

Windows和Virtualbox端口号映射失败怎么办?,第1张

Windows和Virtualbox端口号映射失败怎么办?

  在Virtualbox虚拟机中运行Ubuntu系统时,有时候需要通过端口映射来实现主机pc端和虚拟机内部镜像通信,端口和虚拟机内部的服务相对应。在Virtualbox启动阶段会映射这些端口,然而在Windows中部分机器却出现端口映射失败的情况,那么,Windows和Virtualbox端口号映射失败该怎么办呢?

  端口映射失败日志如下:

  00:00:01.125577 NAT: set redirect UDP host 0.0.0.0:6000 =》 guest 10.0.2.15:6000

  00:00:01.125748 NAT: can‘t create datagram socket

  00:00:01.125763 NAT: failed to redirect UDP 0.0.0.0:6000 =》 10.0.2.15:6000

  00:00:01.125774 NAT: set redirect TCP host 0.0.0.0:6555 =》 guest 10.0.2.15:5555

  00:00:01.125897 NAT: failed to redirect TCP 0.0.0.0:6555 =》 10.0.2.15:5555

  分析:

  1.此处的端口号映射没有占用Windows官方分配的端口号,所有不存在端口号被Windows服务占用导致无效映射的问题

  2.通过netstat -ano查看所有正在使用端口,未发现映射的端口号被占用

  3.上述两点都排除了,那就排查Windows系统本身环境的问题,通过验证发现,可以通过修复工具修复此问题。即是由于Windows本身环境导致的。

  具体修复:Repair Winsock & DNS Cache

  功能说明如下:

  This will clear the stored DNS cache in Windows. When the DNS becomes corrupt you will not be able to get to some sites. Flushing and rebuilding the DNS will fix that problem.

  Also resets winsock entries & resets TCP/IP stack.

  These extra commands are run on Windows vista and newer.

  执行完如下几条命令然后重启,即可修复端口号映射失败问题,此述不仅仅限于Virtualbox要使用的端口映射,其他任何软件使用到端口映射且失败时可以考虑用如下几条命令修复:

  netsh winsock reset all

  netsh int 6to4 reset all

  netsh int ipv4 reset all

  netsh int ipv6 reset all

  netsh int httpstunnel reset all

  netsh int isatap reset all

  netsh int portproxy reset all

  netsh int tcp reset all

  netsh int teredo reset all

  如上这些命令来源于Windows修复工具中其中一项

  如果有其他Windows问题可以尝试用此工具镜像修复。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5593341.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-15
下一篇 2022-12-15

发表评论

登录后才能评论

评论列表(0条)

保存