1. 程式人生 > >centos 重啟防火牆開放80埠

centos 重啟防火牆開放80埠

轉自:https://www.aliyun.com/jiaocheng/140985.html

centos6:
1.開啟80埠:
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
2.儲存設定:
/etc/rc.d/init.d/iptables save
3.重啟防火牆:
service iptables restart
4.檢視防火牆狀態:
/etc/init.d/iptables status
centos7辦法:
1.// 檢視 firewalld
systemctl status firewalld.service
2.// 關閉 firewalld
systemctl stop firewalld.service
3.// 禁止開機啟動 firewalld
systemctl disable firewalld.service
4.// 安裝 iptables
yum install iptables-services
5.// 配置 iptables
vi /etc/sysconfig/iptables
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
6.// 重啟防火牆
service iptables restart