Jar*_*Rox 10 firewall tomcat iptables centos
我正在尝试在 CentOS 环境中部署 Tomcat 服务器,但它没有接收请求。
执行startup.sh正常,日志显示tomcat正在运行
16-Dec-2016 13:36:58.440 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler [http-nio-8080]
16-Dec-2016 13:36:58.444 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler [ajp-nio-8009]
16-Dec-2016 13:36:58.445 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 14803 ms
Run Code Online (Sandbox Code Playgroud)
运行netstat查看监听端口时,显示为listening
$netstat -atnp|grep LISTEN
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 3321/java
Run Code Online (Sandbox Code Playgroud)
为了跳过防火墙,我在 iptables 中添加了一个自定义规则。
$iptables -nL
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:8080
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:50060
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:50030
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:50105
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:50090
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:50075
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:50070
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:123
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Run Code Online (Sandbox Code Playgroud)
我把规则加在最上面是为了避免在一般reject之后加的错误。iptables 处于活动状态,因为服务返回以下内容:
$service iptables status
Redirecting to /bin/systemctl status iptables.service
? iptables.service - IPv4 firewall with iptables
Loaded: loaded (/usr/lib/systemd/system/iptables.service; enabled; vendor preset: disabled)
Active: active (exited) since Fri 2016-12-16 13:09:47 EST; 1h 45min ago
Main PID: 728 (code=exited, status=0/SUCCESS)
CGroup: /system.slice/iptables.service
Run Code Online (Sandbox Code Playgroud)
但是,请求没有到达 Tomcat,因为 localhost 访问日志是空的。
Firewalld 不会干扰连接,因为它声称已被禁用:
$firewall-cmd --state
not running
Run Code Online (Sandbox Code Playgroud)
我还缺少其他防火墙设置吗?
| 归档时间: |
|
| 查看次数: |
1010 次 |
| 最近记录: |