永久打开或则关闭
chkconfig iptables on
chkconfig iptables off
chkconfig iptables on
chkconfig iptables off
即时生效:重启后还原
service iptables status 用于查看是否有开启防方墙.
service iptables stop
在开启了防火墙时,做如下设置,开启相关端口,
修改/etc/sysconfig/iptables 文件,添加以下内容:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT