一,防火墙服务
1,启动、关闭、重启防火墙服务
systemctl start firewalld.service systemctl stop firewalld.service systemctl restart firewalld.service
2,显示防火墙的状态
systemctl status firewalld.service
3,开机启动防火墙
systemctl enable firewalld.service
4,开机时禁用防火墙
systemctl disable firewalld.service
5,查看防火墙是否开机启动
systemctl is-enabled firewalld.service
6,查看已启动的服务列表
systemctl list-unit-files|grep enabled
7,查看启动失败的服务列表
systemctl --failed
8,启动、停止、重启httpd服务
systemctl start httpd systemctl stop httpd systemctl restart httpd
二,防火墙配置
1,查看版本
firewall-cmd --version
2,查看帮助
firewall-cmd --help
3,显示防火墙状态
firewall-cmd --state
4,查看所有打开的端口
firewall-cmd --zone=public --list-ports
5,查看区域信息
firewall-cmd --get-active-zones
6,查看指定接口所属区域
firewall-cmd --get-zone-of-interface=eth0
7,拒绝所有包、取消拒绝状态、查看是否拒绝
firewall-cmd --panic-on firewall-cmd --panic-off firewall-cmd --query-panic
8,开启80端口,–permanent永久生效,没有此参数重启后失效
firewall-cmd --zone=public --add-port=80/tcp --permanent
9,重新载入,更新防火墙规则
firewall-cmd --reload
10,查看80端口是否开放
firewall-cmd --zone=public --query-port=80/tcp
11,删除80端口配置
firewall-cmd --zone=public --remove-port=80/tcp --permanent
OK!到这就结束了,希望能帮到你!!!
文章评论