- 查看防火墙状态
systemctl status firewalld
- 开启防火墙
systemctl start firewalld
- 关闭防火墙
systemctl stop firewalld
- 开启端口
firewall-cmd --zone=public --add-port=8080/tcp --permanent
使用firewall-cmd命令开启,
–zone 作用域
–permanent 是永久生效,重启不会变
–add 是添加端口
/tcp 是协议
修改完记得重载firewall
firewall-cmd --reload
- 开机启停
关闭开机启动
systemctl disable firewalld
开启开机启动
systemctl enable firewalld
- 查看防火墙应用列表
firewall-cmd --list-all
[root@oracle ~]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens33
sources:
services: dhcpv6-client ssh
ports: 22/tcp 80/tcp 8080/tcp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules: