配置了tomcat,更改了默认端口为8070,还是访问不了
公司的运维帅哥说是防火墙没有设置白名单
查看防火墙设置:
[root@VDC-032 bin]# iptables -L
Chain INPUT (policy ACCEPT)target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:http
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
target prot opt source destination
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
直接修改iptables文件:
vim /etc/sysconfig/iptables
加入-A INPUT -p tcp -m state --state NEW -m tcp --dport 8070 -j ACCEPT
iptables文件内容如下:
[root@WXG-002-V3 bin]# more /etc/sysconfig/iptables
# Generated by iptables-save v1.4.7 on Mon Mar 17 10:34:01 2014
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [32:3184]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8070 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A INPUT -p tcp -m tcp --dport 8070 -j ACCEPT
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
或者使用命令行方式设置:
# iptables -A INPUT -p tcp --dport 8070 -j ACCPET
#service iptables save
设置完成后重启iptables service
service iptables restart
还有一种方法,就是不清空防火墙(运维的说法是关闭防火墙)
iptables -F