我正在使用openstack来启动Red Hat Enterprise Linux Server 7.5版(Maipo)并在其中安装apache tomcat 9.0.17,部署一个Web应用程序,但是我无法访问该tomcat网址,例如http://10.157.166.142:8080通过我在同一内部网络中的另一台Windows PC。但我可以在Linux中使用它。
我还向catalina.sh添加以下内容以仅绑定ipv4,并且在进行此更改之前,它仅绑定到ipv6,但其他PC仍无法访问
JAVA_OPTS=" $JAVA_OPTS -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses=true "
curl -v http://localhost:8080正常工作。
ip:192.168.0.14 弹性ip:10.157.166.142
[root@bigdata]# netstat -tupln | grep :8080
tcp 0 0 0.0.0.0:8080 0.0.0.0:*
LISTEN 21373/java
[root@bigdata bin]# service iptables status
Redirecting to /bin/systemctl status iptables.service
● iptables.service - IPv4 firewall with iptables
Loaded: loaded (/usr/lib/systemd/system/iptables.service; disabled;
vendor preset: disabled)
Active: inactive (dead)
使用tcpdump,我尝试从Windows PC访问并获取以下日志:
[root@bigdata docker.service.d]# tcpdump -i eth0 port 8080
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
10:32:07.738897 IP 10.141.174.148.54346 > bigdata.novalocal.webcache: Flags [S], seq 2866917131, win 64240, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
10:32:07.741243 IP 10.141.174.148.54347 > bigdata.novalocal.webcache: Flags [S], seq 3985678636, win 64240, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
10:32:07.990685 IP 10.141.174.148.54350 > bigdata.novalocal.webcache: Flags [S], seq 577076481, win 64240, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
10:32:10.739649 IP 10.141.174.148.54346 > bigdata.novalocal.webcache: Flags [S], seq 2866917131, win 64240, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
10:32:10.741583 IP 10.141.174.148.54347 > bigdata.novalocal.webcache: Flags [S], seq 3985678636, win 64240, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
10:32:10.990666 IP 10.141.174.148.54350 > bigdata.novalocal.webcache: Flags [S], seq 577076481, win 64240, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
10:32:16.738767 IP 10.141.174.148.54346 > bigdata.novalocal.webcache: Flags [S], seq 2866917131, win 64240, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
10:32:16.741559 IP 10.141.174.148.54347 > bigdata.novalocal.webcache: Flags [S], seq 3985678636, win 64240, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
10:32:16.990632 IP 10.141.174.148.54350 > bigdata.novalocal.webcache: Flags [S], seq 577076481, win 64240, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
[root@bigdata docker.service.d]# lsof -i :8080 | grep LISTEN
java 21373 root 54u IPv4 90812729 0t0 TCP *:webcache (LISTEN)
答案 0 :(得分:0)
检查防火墙规则一次。默认情况下,端口8080
可能未打开。
在部署应用程序的计算机上,必须将新规则添加到iptables中以打开端口。
vi /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
esc+:+w+q
退出,或检查this link以查看保存更改后如何退出vi
编辑器/etc/init.d/iptables restart
重新加载iptables 答案 1 :(得分:0)
感谢Yogesh Badke。并添加以下规则。
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT