查看防火墙状态
[root@localhost ~]# firewall-cmd --state
running
禁止使用防火墙
[root@localhost ~]# systemctl stop firewalld.service
禁止重新启动后重启防火墙
[root@localhost ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
关闭防火墙时查看防火墙状态
[root@localhost ~]# firewall-cmd --state
not running
启动防火墙
[root@localhost ~]# systemctl start firewalld.service
开启重新启动后重启防火墙
[root@localhost ~]# systemctl enable firewalld.service
Created symlink from /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service to /usr/lib/systemd/system/firewalld.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/firewalld.service to /usr/lib/systemd/system/firewalld.service.
开启或者关闭某个端口
开启(permanent永久生效,没有此参数重启后失效)
[root@localhost app]# firewall-cmd --zone=public --add-port=15672/tcp --permanent
查看某个端口
[root@localhost ~]# firewall-cmd --query-port=15672/tcp
删除
[root@localhost ~]# firewall-cmd --remove-port=15672/tcp --permanent
重新载入
[root@localhost ~]# firewall-cmd --reload