centos7 關閉默認firewalld,開啟iptables


編者按:

  對於使用了centos6系列系統N年的運維來說,在使用centos7的時候難免會遇到各種不適應。比如防火牆問題。本文主要記錄怎么關閉默認的firewalld防火牆,重新啟用iptables。

 

1.關閉firewalld防火牆

systemctl stop firewalld
systemctl mask firewalld

2.安裝iptables

yum install iptables-services

3.設置開機啟動

systemctl enable iptables.service
systemctl [stop|start|restart] iptables。service
#or
service iptables [stop|start|restart]

注意:

在啟動的時候會遇到這樣的問題:Unit iptables.service failed to load
問題根源是在/etc/sysconfig/下面沒有找到iptables文件。解決辦法如下:
iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
/usr/libexec/iptables/iptables.init save #保存成功
然后再執行
systemctl start iptables.service

  

  

  

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM