掌控网络安全,尽在 Linux 动态防火墙:firewalld 常用命令

1、防火墙的启动、停止

(1)启动防火墙

复制代码
systemctl start firewalld

(2)检查防火墙状态

复制代码
systemctl status firewalld 

(3)关闭防火墙

复制代码
systemctl stop firewalld 

(4)设置防火墙开机自启动

复制代码
systemctl enable firewalld

(5)设置开机禁用防火墙

复制代码
systemctl disable firewalld

2、开放端口

(1)查看已开放的所有端口

复制代码
firewall-cmd --zone=public --list-ports

(2)开放防火墙端口

复制代码
# --permanent:表示将规则永久保存。如果不加此参数,规则只会临时生效,重启防火墙或系统后规则会丢失。 
  firewall-cmd --zone=public --add-port=9000/tcp --permanent

(3)禁止防火墙端口

复制代码
firewall-cmd --zone=public --remove-port=9000/tcp --permanent

(4)重新加载配置

复制代码
firewall-cmd --reload
相关推荐
tntxia13 小时前
linux curl命令详解_curl详解
linux
扛枪的书生15 小时前
Linux 网络管理器用法速查
linux
顺风尿一寸18 小时前
Java Socket 内核之旅:从 SocketChannel.read() 到 tcp_recvmsg 与 epoll 的完整调用链路
linux
XIAOHEZIcode1 天前
Ubuntu 终端美化全栈指南:Bash 到 Kitty 踩坑实录
linux·ubuntu·命令行
唐青枫1 天前
别再只会用 cron:Linux systemd Timer 定时任务实战详解
linux
AlfredZhao3 天前
生产环境里,为什么不建议把普通端口直接暴露到公网?
linux·https·443·80
Flynt4 天前
npm v12 来了:allowScripts 默认关闭,我的项目差点跑不起来
安全·npm·node.js
戴为沐4 天前
Linux内存扩容指南
linux
zylyehuo4 天前
Linux 彻底且安全地删除文件
linux
用户805533698035 天前
主线 U-Boot 上 RK3506:和闭源 rkbin 拔河的三个隐性契约
linux·嵌入式