Linux關閉 開啟 防火墻 命令
1) 永久性生效,重啟后不會復原開啟: chkconfig iptables on
關閉: chkconfig iptables off
2) 即時生效,重啟后復原
開啟: service iptables start
關閉: service iptables stop
需要說明的是對于Linux下的其它服務都可以用以上命令執行開啟和關閉操作。
在開啟了防火墻時,做如下設置,開啟相關端口,
修改/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
posted on 2007-12-02 21:01 hugh 閱讀(2504) 評論(0) 編輯 收藏 所屬分類: Linux