Linux防火墙开放某个端口
我使用的发行版为centOS8
- 开放端口,以开放80端口为例
firewall-cmd --zone=public --add-port=80/tcp --permanent
- 重启防火墙
firewall-cmd --reload
- 查看有那些端口被开放了
firewall-cmd --list-all
操作后总体显示如下
[root@MiWiFi-RA69-srv conf]# firewall-cmd --zone=public --add-port=80/tcp --permanent
success
[root@MiWiFi-RA69-srv conf]# firewall-cmd --reload
success
[root@MiWiFi-RA69-srv conf]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens33
sources:
services: cockpit dhcpv6-client ssh
ports: 3306/tcp 6379/tcp 80/tcp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules: