主机192.168.0.41部署一Springboot应用,端口:0808,URL:/springboot
主机192.168.0.41本机测试正常
[app@app-centos-1 ~]$ curl localhost:8080/springboot
HelloWorld 出 nai nu!!! myIP = app-centos-1/192.168.0.41
客户端192.168.0.42测试失败
[app@app-centos-2 ~]$ curl 192.168.0.41:8080/springboot
curl: (7) Failed connect to 192.168.0.41:8080; No route to host
问题:主机192.168.0.41上的防火墙对8080端口进行了拦截
解决办法:在主机防火墙上添加8080端口
[app@app-centos-1 ~]$ sudo firewall-cmd --permanent --add-port=8080/tcp
[app@app-centos-1 ~]$ sudo firewall-cmd --reload
客户端192.168.0.42测试成功
[app@app-centos-2 ~]$ curl 192.168.0.41:8080/springboot
HelloWorld 出 nai nu!!! myIP = app-centos-1/192.168.0.41