博客
关于我
centos 7如何使用firewalld 添加策略
阅读量:803 次
发布时间:2023-01-26

本文共 861 字,大约阅读时间需要 2 分钟。

firewalld配置指南

启动firewalld

在Linux系统中,firewalld是默认的防火墙管理工具。若需启动firewalld服务,可使用以下命令:

systemctl start firewalld

启动后可查看服务状态,确认是否正常运行:

systemctl status firewalld
或者
firewall-cmd --state

停止firewalld

当不需要firewalld服务时,可以执行以下命令永久禁用服务,并立即停止运行:

systemctl stop firewalld
systemctl disable firewalld

firewalld配置文件修改

为了实现特定网络行为,firewalld使用XML配置文件进行规则定义。以下是public.xml的示例配置,位于/etc/firewalld/zones/目录下:

Public
For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.

所需服务和端口

根据你的实际需求,在Public区域内添加需要管理的服务和端口。例如:

这些配置指令将决定火墙对进入和出站网络连接的情况。

配置完成后操作

执行完上述配置后,测试firewalld服务状态,以确保配置生效:

systemctl status firewalld

如需修改配置,重新加载firewalld以应用更改:

firewall-cmd --reload

注意事项

本文内容最初来源:https://blog.51cto.com/fengxz/1948921

转载请注明原文出处。

你可能感兴趣的文章
Nginx配置代理解决本地html进行ajax请求接口跨域问题
查看>>
Nginx配置参数中文说明
查看>>
Nio ByteBuffer组件读写指针切换原理与常用方法
查看>>
NIO Selector实现原理
查看>>
NISP一级,NISP二级报考说明,零基础入门到精通,收藏这篇就够了
查看>>
NI笔试——大数加法
查看>>
NLP 基于kashgari和BERT实现中文命名实体识别(NER)
查看>>
NMAP网络扫描工具的安装与使用
查看>>
NN&DL4.3 Getting your matrix dimensions right
查看>>
NN&DL4.8 What does this have to do with the brain?
查看>>
No 'Access-Control-Allow-Origin' header is present on the requested resource.
查看>>
No fallbackFactory instance of type class com.ruoyi---SpringCloud Alibaba_若依微服务框架改造---工作笔记005
查看>>
No module named cv2
查看>>
No module named tensorboard.main在安装tensorboardX的时候遇到的问题
查看>>
No qualifying bean of type XXX found for dependency XXX.
查看>>
No resource identifier found for attribute 'srcCompat' in package的解决办法
查看>>
Node.js 文件系统的各种用法和常见场景
查看>>
node.js 配置首页打开页面
查看>>
node.js+react写的一个登录注册 demo测试
查看>>
Node.js安装与配置指南:轻松启航您的JavaScript服务器之旅
查看>>