<table class="text"><tbody><tr class="li1">
<td class="ln"><pre class="de1">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
@H_301_1@</td>
<td class="de1"><pre class="de1">1.查看防火墙状态
[root@iZ237682 ~]# firewall-cmd --state
not running
2.systemctl start/stop/restart firewalld
3.开机启动
systemctl enable firewalld
4.查看防火墙规则
[root@iZ237 ~]# firewall-cmd --list-all
public
target: default
icmp-block-inversion: no
interfaces:
sources:
services: ssh dhcpv6-client
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
5. 查询端口是否开放
firewall-cmd --query-port=80/tcp
6. 开放80端口
firewall-cmd --permanent --add-port=80/tcp
7. 移除端口
firewall-cmd --permanent --remove-port=80/tcp
8.重启防火墙(修改配置后要重启防火墙)
firewall-cmd --reload
参数解释
1、firwall-cmd:是Linux提供的操作firewall的一个工具;
2、--permanent:表示设置为持久;
3、--add-port:标识添加的端口;@H_301_1@</td>
</tr></table>