linux查看防火墙状态及开启关闭命令
#查看防火墙状态
[root@localhost /]# service iptables status
表格: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
#防火墙开启,关闭防火墙
[root@localhost /]# service iptables stop
iptables:清除防火墙规则: [确定]
iptables:将链设置为政策 ACCEPT:filter [确定]
iptables:正在卸载模块: [确定]
[root@localhost /]#
[root@localhost /]#
[root@localhost /]# service iptables status
iptables:未运行防火墙。
#防火墙关闭,开启防火墙
[root@localhost /]# service iptables start
iptables:应用防火墙规则: [确定]
[root@localhost /]#
#查看防火墙状态
[root@localhost /]# /etc/init.d/iptables status
表格: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
#防火墙开启,关闭防火墙
[root@localhost /]# /etc/init.d/iptables stop
iptables:清除防火墙规则: [确定]
iptables:将链设置为政策 ACCEPT:filter [确定]
iptables:正在卸载模块: [确定]
[root@localhost /]#
[root@localhost /]#
[root@localhost /]# /etc/init.d/iptables status
iptables:未运行防火墙。
[root@localhost /]#
#防火墙关闭,开启防火墙
[root@localhost /]# /etc/init.d/iptables restart
iptables:应用防火墙规则: [确定]
[root@localhost /]#
上一个教程:运维应该知道的Linux命令
下一个教程:lscpu命令详解