編者按:
對於使用了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