防火牆命令(iptables)命令# systemctl restart iptables.service失效


 

Redirecting to /bin/systemctl restart iptables.ser

linux下執行防火牆相關指令報錯:

Redirecting to /bin/systemctl restart iptables.service

1,安裝systemctl:

yum install iptables-services

2,設置開機啟動:

systemctl enable iptables.service

然后就可以執行以下指令了:

systemctl stop iptables
systemctl start iptables
systemctl restart iptables
systemctl reload iptables




CentOS 7.0默認使用的是firewall作為防火牆,這里改為iptables防火牆。
1、關閉firewall:

systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl mask firewalld.service
2、安裝iptables防火牆

yum install iptables-services -y
3.啟動設置防火牆

systemctl enable iptables
systemctl start iptables

4.查看防火牆狀態

systemctl status iptables
5編輯防火牆,增加端口

vi /etc/sysconfig/iptables #編輯防火牆配置文件
 

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

:wq! #保存退出

3.重啟配置,重啟系統

systemctl restart iptables.service #重啟防火牆使配置生效
systemctl enable iptables.service #設置防火牆開機啟動

 


免責聲明!

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



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