1. 程式人生 > 實用技巧 >CentOS-6.8關閉防火牆

CentOS-6.8關閉防火牆

// 使用sudo service iptables status命令來檢視防火牆的狀態
[root@CentOS64 bin]# sudo 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 
6    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:6379 

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         

// 使用sudo service iptables stop命令來關閉防火牆
[root@CentOS64 bin]# sudo service iptables stop
iptables:將鏈設定為政策 ACCEPT:filter                    [確定]
iptables:清除防火牆規則:                                 [確定]
iptables:正在解除安裝模組:                                   [確定]

// 關閉防火牆之後繼續檢視防火牆狀態,顯示防火牆已經關閉
[root@CentOS64 bin]# sudo service iptables status
iptables:未執行防火牆。