CentOS7系统默认firewall防火墙更换为iptables防火墙图文教程

这两天得到消息称CentOS8到明年就不受支持了,很多升级到CentOS8的国内外小伙伴叫苦不迭。但实际上大部分网站环境都是基于CentOS7的,更有甚者还在CentOS6一直不升级。其中CentOS7系统默认是firewall防火墙,用惯了CentOS6系统iptables防火墙的小伙伴非常不习惯,这里就分享一下CentOS7系统默认firewall防火墙更换为iptables防火墙图文教程。

一、将CentOS7系统默认firewall防火墙改为iptables防火墙

查询firewall防火墙是否在运行

systemctl status firewalld

一般会返回如下代码如图

CentOS7系统默认firewall防火墙更换为iptables防火墙图文教程插图

1、首先停止并屏蔽firewalld服务

停止firewalld服务:

systemctl stop firewalld

屏蔽firewalld服务:

systemctl mask firewalld

2、安装iptables-service软件包

yum install iptables-services

这里输入y进行安装

CentOS7系统默认firewall防火墙更换为iptables防火墙图文教程插图1

3、在引导时启用iptables服务

systemctl enable iptables

4、启动iptables服务

systemctl start iptables

5、保存防火墙规则

service iptables save

再去查看发现已经有了iptables文件

查看iptables防火墙是否启动

systemctl status iptables
CentOS7系统默认firewall防火墙更换为iptables防火墙图文教程插图2

二、CentOS改回firewalld防火墙

1) 开机自动启动firewalld防火墙

systemctl enable firewalld.service

2)关闭开机制动启动

systemctl disable firewalld.service

3)查看状态

systemctl status firewalld

4)启用防火墙firewalld

systemctl start firewalld.service

 收藏 (0) 更新不易,打赏吧

您可以选择一种方式赞助本站

支付宝扫一扫赞助

微信钱包扫描赞助

除特别注明外,本站所有文章均基于CC-BY-NC-SA 4.0原创,转载请注明出处。
文章名称:《CentOS7系统默认firewall防火墙更换为iptables防火墙图文教程》
文章链接:https://www.xiapilu.com/web/web-tutorial/centos7-firewall-iptables.html
分享到: 生成海报

评论 抢沙发

评论前必须登录!

立即登录   注册

切换注册

登录

忘记密码 ?

切换登录

注册

我们将发送一封验证邮件至你的邮箱, 请正确填写以完成账号注册和激活