修正格式.

Signed-off-by: lion.chan <cy187lion@sina.com>
This commit is contained in:
lion.chan 2022-05-02 11:33:03 +08:00
parent 08bdf74235
commit 0bebd82cf7
1 changed files with 18 additions and 10 deletions

View File

@ -2,23 +2,29 @@
## 开启/关闭 firewalld 防火墙
systemctl enable firewalld.service
systemctl start firewalld.service
systemctl stop firewalld.service
```bash
sudo systemctl enable firewalld.service
sudo systemctl start firewalld.service
sudo systemctl stop firewalld.service
```
## 设置防火墙规则
添加/删除/查询服务命令如下:
firewall-cmd --permanent --add-port=8080/tcp
firewall-cmd --permanent --remove-port=8080/udp
firewall-cmd --query-port=8080/tcp
```bash
sudo firewall-cmd --permanent --add-port=8080/tcp
sudo firewall-cmd --permanent --remove-port=8080/udp
sudo firewall-cmd --query-port=8080/tcp
```
添加/删除/查询端口命令如下:
firewall-cmd --permanent --add-service=ssh
firewall-cmd --permanent --remove-service=samba
firewall-cmd --query-service=ssh
```bash
sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --permanent --remove-service=samba
sudo firewall-cmd --query-service=ssh
```
参数 --permanent 表示进行的是永久性配置(默认为临时配置,重启后失效)。
@ -26,4 +32,6 @@
修改规则后需要重启防火墙,使配置生效:
firewall-cmd --reload
```bash
sudo firewall-cmd --reload
```