1) 重啟后生效
開啟: chkconfig iptables on
關(guān)閉: chkconfig iptables off
2) 即時(shí)生效,重啟后失效
開啟: service iptables start
關(guān)閉: service iptables stop
需要說明的是對(duì)于Linux下的其它服務(wù)都可以用以上命令執(zhí)行開啟和關(guān)閉操作。
在開啟了防火墻時(shí),做如下設(shè)置,開啟相關(guān)端口,
修改/etc/sysconfig/iptables 文件,添加以下內(nèi)容:
-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