1. 程式人生 > >CentOS6 CentOS7 關閉防火牆命令

CentOS6 CentOS7 關閉防火牆命令

一、CentOS 6 關閉防火牆的命令

// 臨時關閉防火牆
service iptables stop

// 禁止開機啟動防火牆
chkconfig iptables off

二、CentOS 7 關閉防火牆的命令

    CentOS 7 與 CentOS 6 在關閉防火牆的命令上,有了很大的區別。具體如下:

1. CentOS 7使用systemctl 來執行命令,而CentOS 6是用service來執行命令的。

2. CentOS 6使用的是 iptables。CentOS 7 使用的是firewalld,而不在使用iptables

CentOS7中若使用同樣的命令會報錯:

# systemctl stop iptables
Failed to stop iptables.service: Unit iptables.service not loaded.

    CentOS 7 關閉防火牆的命令如下:

// 臨時關閉防火牆
systemctl stop firewalld

// 禁止開機啟動防火牆
systemctl disable firewalld