查看防火墙状态
1 | [root@localhost /]# systemctl status firewalld |
开启防火墙
1 | [root@localhost /]# systemctl start firewalld |
关闭防火墙
1 | [root@localhost /]# systemctl stop firewalld |
查看已开放端口
1 | [root@localhost /]# firewall-cmd --list-all |
防火墙开放端口:(开放端口后需重载防火墙)
1 | [root@localhost /]# firewall-cmd --zone=public --add-port=3306/tcp --permanent |
移除开放的端口
1 | [root@localhost /]# firewall-cmd --zone=public --remove-port=80/tcp --permanent |
firewalld 基本使用
1 | firewalld的基本使用 |
systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。
1 | 启动一个服务:systemctl start firewalld.service |
配置firewalld-cmd
1 | 查看版本: firewall-cmd --version |