查看防火墙状态
or
root@localhost ~]# systemctl status firewalld / firewall-cmd --state
启动防火墙
[root@localhost ~]# systemctl start firewalld
关闭防火墙
[root@localhost ~]# systemctl stop firewalld
设置开机启动
[root@localhost ~]# systemctl enable firewalld
停止并禁用开机启动
[root@localhost ~]# sytemctl disable firewalld
端口设置:
Linux 防火墙开放端口命令:
firewall-cmd --zone=public --permanent --add-port=port(要添加的端口号)/tcp (permanent参数是为了设置为永久生效)
重启防火墙
[root@localhost ~]# firewall-cmd --reload
查看防火墙开放的所有端口列表
[root@localhost ~]# firewall-cmd --zone=public --list-ports