--- 查看防火墙状态
#service iptables status
如果防火墙未启用,则提示:“iptables: Firewall is not running.”
如果防火墙已启用,则给出如下格式信息:
Table: filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
5 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
--- 启动防火墙
#service iptables start
如果启动成功,则提示:
iptables: Applying firewall rules: [ OK ]
--- 停止防火墙
#service iptables stop
如果停止成功,则提示:
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
centOS7 默认使用的防火墙是firewall,不再是iptables。
http://huangqiqing123.iteye.com/blog/2301462