无法远程访问windows下的linux(ubuntu)子系统里服务的问题解决方案

1,问题:当我在windows下的ubuntu中启动spring boot项目后,在本地浏览器访问:

http://10.240.xxx.75:8089/health/status

是正常的,然而远程访问时,却访问不了

2,解决过程:

1)按照网上类似问题提供的解决方法:
首先查询防火墙状态:sudo ufw status,结果执行后报错:

ERROR: initcaps [Errno 2] iptables v1.6.0: can't initialize iptables table `filter':
Table does not exist (do you need to insmod?) Perhaps iptables or your kernel needs to be upgraded.

于是安装防火墙:sudo apt-get install ufw,事实上因为ubuntu默主已安装防火墙,所以执行安装不会安装新的东西

Reading package lists... Done
Building dependency tree
Reading state information... Done
ufw is already the newest version (0.35-0ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 74 not upgraded.

2)然后看有的网友不知道从哪里来的升级kernel复杂教程,还不忘备注“以上还还没有验证”类似说明,所以为了大量操作后,升级途中再出问题卸载不了,所以暂时放弃了这种方式

3,最终解决办法:

将windows中的防火墙全部关闭,结果远程可以正常访问ubuntu中部署的服务了。

但是关闭全部防火墙肯定不是个好办法,所以正确的做法应该是将指定的端口开放给指定的机器访问,设置方法访问下面链接:

windows 10 防火墙设置规则:使特定ip通过某端口连接我的电脑

猜你喜欢

转载自blog.csdn.net/qq_2300688967/article/details/81779534