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

转载请注明原文出处。

你可能感兴趣的文章
poj 2236
查看>>
POJ 2243 Knight Moves
查看>>
POJ 2262 Goldbach's Conjecture
查看>>
POJ 2362 Square DFS
查看>>
Qt笔记——解决添加Qt Designer Form Class时“allocation of incomplete type Ui::”
查看>>
poj 2386 Lake Counting(BFS解法)
查看>>
poj 2387 最短路模板题
查看>>
POJ 2391 多源多汇拆点最大流 +flody+二分答案
查看>>
POJ 2403
查看>>
poj 2406 还是KMP的简单应用
查看>>
POJ 2431 Expedition 优先队列
查看>>
Qt笔记——获取位置信息的相关函数
查看>>
POJ 2484 A Funny Game(神题!)
查看>>
POJ 2486 树形dp
查看>>
POJ 2488:A Knight's Journey
查看>>
SpringBoot为什么易学难精?
查看>>
poj 2545 Hamming Problem
查看>>
poj 2723
查看>>
poj 2763 Housewife Wind
查看>>
Qt笔记——模型/视图MVD 文件目录浏览器软件
查看>>