一、CentOS7預設的防火牆是firewall
1、關閉firewall防火牆:sudo systemctl stop firewalld.service
2、關閉firewall開機啟動:sudo systemctl disable firewalld.service
systemctl start firewalld # 啟動,
systemctl enable firewalld # 開機啟動
systemctl stop firewalld # 關閉
systemctl disable firewalld # 取消開機啟動
firewall-cmd --state
systemctl unmask firewalld
執行 systemctl start firewalld 指令後出現Failed to start firewalld.service: Unit is masked. 這個提示是個什麼意思,有沒有
linux大神幫忙解釋一下
firewalld服務被鎖定,執行指令
systemctl unmask firewalld 即可實作取消服務的鎖定,
下次需要鎖定該服務時執行systemctl mask firewalld
二、想用iptables的話,則:
3、安裝iptables防火牆
執行以下指令安裝iptables防火牆:
sudo yum install iptables
sudo yum install iptables-services
4、配置iptables防火牆,打開指定端口
5. 設定iptables防火牆開機啟動:
service iptables restart #重新開機
chkconfig iptables on或者systemctl enable iptables.service開機自啟
原文連結:
https://blog.csdn.net/libaineu2004/article/details/77101608