CentOS 7 防火墙常用操作及常见问题处理

一、常用操作

1、启动防火墙:

systemctl start firewalld.service

2、关闭防火墙:

systemctl stop firewalld.service

3、添加放行端口:

firewall-cmd --zone=public --add-port=8161/tcp --permanent (--permanent永久生效,没有此参数重启后失效)

4、锁定防火墙服务(防止添加端口等操作):

systemctl mask firewalld

5、取消锁定:

systemctl unmask firewalld

二、常见问题及解决办法

1、当出现如下 “firewalld.service: Unit is masked” 错误时,说明服务被锁定,此时我们取消锁定即可:

图1-1

三、附录

CentOS 7 默认使用的是firewall作为防火墙,可通过如下操作改为iptables防火墙。

1、停止 firewall

systemctl stop firewalld.service

2、禁止 firewall 开机启动

systemctl disable firewalld.service

3、安装 iptables-services

yum install iptables-services

4、启用iptables-services

systemctl enable iptables

5、启动 iptables

service iptables start

备注:

本文仅记录自己遇到并且实际操作解决过的问题,后续会持续更新。

转载于:https://www.cnblogs.com/Rozdy/p/11497232.html

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值