1. 编辑 /etc/sysconfig/iptables
#vi /etc/sysconfig/iptables
如下添加8080端口:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
2 重启iptables
# /etc/init.d/iptables restart
3. 查看状态
# /etc/init.d/iptables status
重启后永久性生效:
开启:chkconfig iptables on
关闭:chkconfig iptables off
即时生效,重启后失效:
开启:service iptables start
关闭:service iptables stop