1.firewalld基本命令
[root@host]# systemctl start firewalld # 启动
[root@host]# systemctl stop firewalld # 停止
[root@host]# systemctl status firewalld # 查看状态
[root@host]# systemctl disable firewalld # 开机禁用
[root@host]# systemctl enable firewalld # 开机启用
2.firewall-cmd管理防火墙
[root@host]# firewall-cmd --version # 查看版本
[root@host]# firewall-cmd --state # 查看运行状态
[root@host]# firewall-cmd --list-port # 列出所有打开的端口
- 防火墙端口端口开放和删除
[root@host]# firewall-cmd --zone=public --add-port=80/tcp --permanent (–permanent永久生效,没有此参数重启后失效)# 开启80端口
[root@host]# firewall-cmd --reload # 重新载入设置
[root@host]# firewall-cmd --query-port=80/tcp # 查看端口是否开启
[root@host]# firewall-cmd --remove-port=80/tcp --permanent # 删除端口
[root@host]# firewall-cmd --reload # 重新载入设置