詳解centos6和centos7防火牆的關閉
CentOS6.5檢視防火牆的狀態:
1 |
[[email protected]
~]$service iptable status
|
顯示結果:
?1 2 3 4 5 6 7 8 9 |
[[email protected]
~]$service iptable status
Redirecting
to /bin/systemctl
status iptable.service iptable.service
Loaded:
not-found (Reason: No such file
or directory)
Active:
inactive (dead) --表示防火牆已經關閉
|
CentOS 6.5關閉防火牆
?1 2 3 |
[[email protected]
~] #servcie
iptables stop --臨時關閉防火牆
[[email protected] #chkconfig
iptables off --永久關閉防火牆
|
CentOS 7.2關閉防火牆
CentOS 7.0預設使用的是firewall作為防火牆,這裡改為iptables防火牆步驟。
firewall-cmd --state #檢視預設防火牆狀態(關閉後顯示notrunning,開啟後顯示running)
?1 2 3 |
[[email protected]
~] #firewall-cmd
--state
not
running |
檢查防火牆的狀態:
從centos7開始使用systemctl來管理服務和程式,包括了service和chkconfig。
?1 2 3 |
[[email protected]
~] #systemctl
list-unit-files|grep firewalld.service --防火牆處於關閉狀態
firewalld.service
disabled
|
或者
?