无法在IPTABLES防火墙上打开PORT

时间:2012-01-30 10:00:43

标签: linux port firewall iptables

我很难理解为什么我无法通过添加IPTABLES规则来打开端口61616。以下是通过IPTABLES -L命令获得的所有规则的列表。

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:61616
ACCEPT     udp  --  anywhere             anywhere            udp dpt:cslistener
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:cslistener
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:webcache
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:smtp
RH-Firewall-1-INPUT  all  --  anywhere             anywhere

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
RH-Firewall-1-INPUT  all  --  anywhere             anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain RH-Firewall-1-INPUT (2 references)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:61616
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:http
ACCEPT     all  --  anywhere             anywhere
ACCEPT     icmp --  anywhere             anywhere            icmp any
ACCEPT     esp  --  anywhere             anywhere
ACCEPT     ah   --  anywhere             anywhere
ACCEPT     udp  --  anywhere             224.0.0.251         udp dpt:mdns
ACCEPT     udp  --  anywhere             anywhere            udp dpt:ipp
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:ipp
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited

尽管我对IPTABLES一无所知,让我感到困惑的是,http端口是从外部可见的,但端口61616仍然不是。对我来说,规则看起来一样。无论如何,所有帮助都表示赞赏。

最佳

1 个答案:

答案 0 :(得分:0)

也许您尝试在CentOS主机后面的网络中打开主机端口(CentOS主机是网络防火墙)? 如果是这样,您必须为表过滤器的链FORWARD添加规则,您应该这样做 将DNAT规则添加到网络x.x.x.x中的某些IP

iptables -A FORWARD -p tcp --dport 61616 -j  ACCEPT
iptables -A PREROUTING -t nat -p tcp --dport 61616 -j DNAT --to-destinanion x.x.x.x