linux查看防火墻狀態(tài)及開啟關(guān)閉命令
#查看防火墻狀態(tài)
[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
#防火墻開啟,關(guān)閉防火墻
[root@localhost /]# service iptables stop
iptables:清除防火墻規(guī)則: [確定]
iptables:將鏈設(shè)置為政策 ACCEPT:filter [確定]
iptables:正在卸載模塊: [確定]
[root@localhost /]#
[root@localhost /]#
[root@localhost /]# service iptables status
iptables:未運(yùn)行防火墻。
#防火墻關(guān)閉,開啟防火墻
[root@localhost /]# service iptables start
iptables:應(yīng)用防火墻規(guī)則: [確定]
[root@localhost /]#
#查看防火墻狀態(tài)
[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
#防火墻開啟,關(guān)閉防火墻
[root@localhost /]# /etc/init.d/iptables stop
iptables:清除防火墻規(guī)則: [確定]
iptables:將鏈設(shè)置為政策 ACCEPT:filter [確定]
iptables:正在卸載模塊: [確定]
[root@localhost /]#
[root@localhost /]#
[root@localhost /]# /etc/init.d/iptables status
iptables:未運(yùn)行防火墻。
[root@localhost /]#
#防火墻關(guān)閉,開啟防火墻
[root@localhost /]# /etc/init.d/iptables restart
iptables:應(yīng)用防火墻規(guī)則: [確定]
[root@localhost /]#
上一個(gè)教程:運(yùn)維應(yīng)該知道的Linux命令
下一個(gè)教程:lscpu命令詳解