---
title: "CentOS7 防火墙相关命令"
author: "linyinpeng1989"
date: "2018-09-25T12:56:09Z"
tags: []
categories: ["操作系统"]
slug: "centos7"
draft: false
lastmod: "2018-09-25T12:56:09Z"
id: 2428748
url: "https://chaser520.iteye.com/blog/2428748"
---

操作系统：CentOS 7

## 防火墙（firewalld）相关

- 启动防火墙： systemctl start firewalld
- 关闭防火墙：systemctl stop firewalld
- 查看状态：systemctl status firewalld
- 开机启用：systemctl enable firewalld
- 禁止开机启用：systemctl disable firewalld
- 开放端口：firewall-cmd --zone=public --add-port=80/tcp --permanent （permanent 表示永久生效）
- 重新载入：firewall-cmd --reload
- 查看端口：firewall-cmd --zone= public --query-port=80/tcp
- 删除端口：firewall-cmd --zone= public --remove-port=80/tcp --permanent