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
linux 防火墙命令
最新推荐文章于 2024-06-27 10:38:06 发布