UP | HOME

firewall-cmd 操作记录

Table of Contents

1. firewall-cmd 常用操作记录

1.1. 服务

#查看状态
systemctl status firewalld.service

#启动
systemctl start firewalld.service
#停止
systemctl stop firewalld.service

#开启自启动
systemctl enable firewalld.service
#关闭自启动
systemctl disable firewalld.service

1.2. 配置

1.2.1. 查看版本

firewall-cmd –version

1.2.2. 查看帮助

firewall-cmd –help

1.2.3. 列出所有可用的服务

firewall-cmd –list-services

1.2.4. 重新加载防火墙规则

firewall-cmd –reload

1.2.5. 列出所有规则

firewall-cmd –list-all

1.2.6. 添加服务

firewall-cmd –zone=区域 –add-service=服务 –permanent

firewall-cmd --zone=public --add-service=http --permanent

1.2.7. 删除服务

firewall-cmd –zone=区域 –remove-service=服务 –permanent

firewall-cmd --zone=public --remove-service=http --permanent

1.2.8. 添加端口

firewall-cmd –zone=区域 –add-port=端口号/端口协议 –permanent

firewall-cmd --zone=public --add-port=80/tcp --permanent

1.2.9. 删除端口

firewall-cmd –zone=区域 –remove-port=端口号/端口协议 –permanent

firewall-cmd --zone=public --remove-port=80/tcp --permanent

1.2.10. 设置区域

firewall-cmd –set-default-zone=区域

firewall-cmd --set-default-zone=home

1.2.11. 查看当前区域

firewall-cmd –get-active-zones

2. firewall config gui

#+begin_src bash #fedora sudo dnf install firewall-config #+end_src>

Author: JosephTseng

Lastmod: <2024-06-19 Wed>

License: CC BY-NC-ND 4.0

Last updated: 2024-06-20 Thu 00:03
Power by Emacs 29.1 (Org mode 9.6)
© 2017 – 2023 by JosephTseng