网站首页 > 教程文章 正文
# 检查防火墙状态
# 确认 firewalld 服务正在运行。
sudo systemctl status firewalld
# 如果防火墙未运行,先启动它
sudo systemctl start firewalld
sudo systemctl enable firewalld # 设置开机自启
# 查看 firewalld 中永久生效的规则
sudo firewall-cmd --permanent --list-ports
sudo firewall-cmd --permanent --list-services
# 添加端口
# 使用 --add-port 参数来添加端口。--permanent 参数表示永久生效,否则重启防火墙后规则会丢失。
sudo firewall-cmd --zone=public --add-port=8090/tcp --permanent
# 重新加载防火墙
# 为了使永久生效的规则立即应用,需要重新加载防火墙配置。
sudo firewall-cmd --reload
# 使用 netstat 查看监听端口
sudo netstat -tuln
# 使用 lsof 命令查看哪个程序在使用这个端口
sudo ss -tulnp | grep :9443
# 查看所有正在运行的 Docker 容器及其端口映射
sudo docker ps --format "table {{.ID}}\t{{.Names}}\t{{.Ports}}"
Docker 在操作时会自动在 iptables(底层防火墙) 中创建规则来管理容器的网络流量,这可能会绕过或直接操作 firewalld。
# 查看 NAT 表中的规则(Docker 端口映射在这里)
sudo iptables -t nat -L -n -v | grep 9443
- 上一篇: 国际云代理商:IPS与IDS与防火墙与WAF,它们之间有什么区别?
- 下一篇:已经是最后一篇了
猜你喜欢
- 2025-10-13 国际云代理商:IPS与IDS与防火墙与WAF,它们之间有什么区别?
- 2025-10-13 运维基操-防火墙Firewalld 使用指南
- 2025-10-13 iptables 使用conntrack ctstate 提高防火墙处理效率
- 2025-10-13 网闸与防火墙,一个擅长隔离,一个精于过滤
- 2025-10-13 网络安全四大天王:IDS、IPS、防火墙、蜜罐
- 2025-10-13 firewall-cmd详解:从zone到service,5分钟搞定防火墙配置
- 2025-10-13 现在的防火墙太强大了,天然集成IPS和IDS
- 2025-10-13 防火墙如何处理网络协议的不同层次
- 2025-10-13 每天一个网络知识:什么是防火墙?_什么是防火墙,有哪些基本类型
- 最近发表
- 标签列表
-
- location.href (44)
- document.ready (36)
- git checkout -b (34)
- 跃点数 (35)
- 阿里云镜像地址 (33)
- qt qmessagebox (36)
- mybatis plus page (35)
- vue @scroll (38)
- 堆栈区别 (33)
- 什么是容器 (33)
- sha1 md5 (33)
- navicat导出数据 (34)
- 阿里云acp考试 (33)
- 阿里云 nacos (34)
- redhat官网下载镜像 (36)
- srs服务器 (33)
- pico开发者 (33)
- https的端口号 (34)
- vscode更改主题 (35)
- 阿里云资源池 (34)
- os.path.join (33)
- redis aof rdb 区别 (33)
- 302跳转 (33)
- http method (35)
- js array splice (33)