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

转载请注明原文出处。

你可能感兴趣的文章
param[:]=param-lr*param.grad/batch_size的理解
查看>>
Spring Cloud 之注册中心 EurekaServerAutoConfiguration源码分析
查看>>
ParseChat应用源码ios版
查看>>
Part 2异常和错误
查看>>
Spring @Async执行异步方法的简单使用
查看>>
PAT 1027 Colors in Mars
查看>>
PAT 1127 ZigZagging on a Tree[难]
查看>>
PAT 2-07. 素因子分解(20)
查看>>
PAT-1044. Shopping in Mars (25)
查看>>
PAT-乙级-1040 有几个PAT
查看>>
PAT1093 Count PAT's (25)(逻辑题)
查看>>
PATA1038题解(需复习)
查看>>
Patching Array
查看>>
Path does not chain with any of the trust anchors
查看>>
Path形状获取字符串型变量数据
查看>>
PAT甲级——1001 A+B Format (20分)
查看>>
Skywalking原理
查看>>
PAT甲级——1006 Sign In and Sign Out (25分)
查看>>
PAT甲级——1007 Maximum Subsequence Sum (25分)
查看>>
PAT甲级——1009 Product of Polynomials (25分)(最后一个测试点段错误)
查看>>