linux下防火墙 开启某个端口

直接在/etc/sysconfig/iptables中增加一行:

-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 8080 -j ACCEPT

      注意添加位置:

         -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT

-ARH-Firewall-1-INPUT-mstate--stateNEW-mtcp-ptcp--dport11211-jACCEPT(新添加的)

         -A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited

    //在这下面加没有用         -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 11211 -j ACCEPT(新添加的)

#重启防火墙以便改动生效

/etc/init.d/iptables restart

相关推荐