1. 重啟系統生效
開啟: chkconfig iptables on
關閉: chkconfig iptables off
2. 即時生效,重啟后失效
開啟: service iptables start
關閉: service iptables stop
開啟: service iptables start
關閉: service iptables stop
在開啟了防火牆時,做如下設置,開啟25和110端口,
修改/etc/sysconfig/iptables 文件,添加以下內容:
-A RH-Firewall-1-INPUT -m state --state NEW -p tcp -m tcp --dport 25 --syn -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -p tcp -m tcp --dport 110 --syn -j ACCEPT
修改/etc/sysconfig/iptables 文件,添加以下內容:
-A RH-Firewall-1-INPUT -m state --state NEW -p tcp -m tcp --dport 25 --syn -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -p tcp -m tcp --dport 110 --syn -j ACCEPT
# chkconfig
usage: chkconfig --list [name]
chkconfig --add <name>
chkconfig --del <name>
chkconfig [--level <levels>] <name> <on|off|reset|resetpriorities>
# service
Usage: service < option > | --status-all | [ service_name [ command | --full-restart ] ]