博客
关于我
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

转载请注明原文出处。

你可能感兴趣的文章
Pytest测试框架快速搭建
查看>>
pytest测试框架:最强大的自动化测试工具,让测试变得轻松有趣
查看>>
pytest简介及jenkins集成
查看>>
Pytest自动化框架运行全局配置文件pytest.ini
查看>>
pytest自动化测试-Git中的测试用例运行
查看>>
Pytest自动化测试-简易入门教程(01)
查看>>
Pytest自动化测试-简易入门教程(02)
查看>>
Pytest自动化测试-简易入门教程(03)
查看>>
Pytest自动化测试指定执行测试用例
查看>>
Pytest自动化测试框架 fixture 传参实战
查看>>
pytest自动化测试框架pytest.ini配置文件详细
查看>>
Pytest自动化测试框架介绍
查看>>
Pytest自动化测试框架,建议收藏。
查看>>
Pytest自动化测试框架:mark用法---测试用例分组执行
查看>>
PyTorch 1.0 中文官方教程:强化学习 (DQN) 教程
查看>>
pytest:4种方法实现 - 重复执行用例 - 展示迭代次数
查看>>
Pytest:一个卓有成效的测试工具
查看>>
python
查看>>
Python "HTTP Error 403: Forbidden"
查看>>
python %ns的作用
查看>>