本文共 861 字,大约阅读时间需要 2 分钟。
在Linux系统中,firewalld是默认的防火墙管理工具。若需启动firewalld服务,可使用以下命令:
systemctl start firewalld
启动后可查看服务状态,确认是否正常运行:
systemctl status firewalld或者firewall-cmd --state
当不需要firewalld服务时,可以执行以下命令永久禁用服务,并立即停止运行:
systemctl stop firewalldsystemctl disable 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
转载请注明原文出处。