centos7的防火墙

一、防火墙的开启、关闭、禁用命令

(1)设置开机启用防火墙:systemctl enable firewalld.service

(2)设置开机禁用防火墙:systemctl disable firewalld.service

(3)启动防火墙:systemctl start firewalld

(4)关闭防火墙:systemctl stop firewalld

(5)检查防火墙状态:systemctl status firewalld

二、使用firewall-cmd配置端口

(1)查看防火墙状态:firewall-cmd --state

(2)重新加载配置:firewall-cmd --reload

(3)查看开放的端口:firewall-cmd --list-ports

(4)开启防火墙端口:firewall-cmd --zone=public --add-port=80/tcp --permanent

命令含义:

--zone #作用域

--add-port=80/tcp #添加端口,格式为:端口/通讯协议

--permanent #永久生效,没有此参数重启后失效

注意:添加端口后,必须用命令firewall-cmd --reload重新加载一遍才会生效

(5)关闭防火墙端口:firewall-cmd --zone=public --remove-port=80/tcp --permanent

相关推荐
百***86461 天前
新版 WSL2 2.0 设置 Windows 和 WSL 镜像网络教程
windows
qq_479875431 天前
X-Macros(1)
linux·服务器·windows
王 富贵1 天前
Conda常用命令大全
windows·conda
jun_bai1 天前
python写的文件备份网盘程序
运维·服务器·网络
爱吃牛肉的大老虎1 天前
网络传输架构之gRPC讲解
网络·架构
Warren981 天前
Python自动化测试全栈面试
服务器·网络·数据库·mysql·ubuntu·面试·职场和发展
weixin_457760001 天前
Python 数据结构
数据结构·windows·python
欢喜躲在眉梢里1 天前
CANN 异构计算架构实操指南:从环境部署到 AI 任务加速全流程
运维·服务器·人工智能·ai·架构·计算
q***13611 天前
Windows操作系统部署Tomcat详细讲解
java·windows·tomcat
云飞云共享云桌面1 天前
无需配置传统电脑——智能装备工厂10个SolidWorks共享一台工作站
运维·服务器·前端·网络·算法·电脑