文章目录
- CentOS7查看和关闭防火墙
- 1.CentOS 7 默认使用的是firewall作为防火墙
- 2.查看防火墙状态
- 3.停止firewall
- 4.禁止firewall开机启动
- 5.开启防火墙开机启动
- 6.开启端口
- 7.移除端口
- 8.重启防火墙
- 9.查看某个端口是否开启
- 10.查询开放列表
- 总结:systemctl常用命令
- 总结:firewalld-cmd配置
CentOS7查看和关闭防火墙
1.CentOS 7 默认使用的是firewall作为防火墙
2.查看防火墙状态
systemctl status firewalld
firewall-cmd --state
3.停止firewall
systemctl stop firewalld.service
4.禁止firewall开机启动
systemctl disable firewalld.service
5.开启防火墙开机启动
systemctl enable firewalld.service
6.开启端口
firewall-cmd --zone=public --add-port=80/tcp --permanent
7.移除端口
firewall-cmd --zone=public --remove-port=80/tcp --permanent
firewall-cmd --permanent --remove-port=123/tcp
8.重启防火墙
firewall-cmd --reload
9.查看某个端口是否开启
firewall-cmd --query-port=80/tcp
10.查询开放列表
firewall-cmd --list-port
总结:systemctl常用命令
systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。
systemctl start firewalld.service
systemctl stop firewalld.service
systemctl restart firewalld.service
systemctl status firewalld.service
systemctl enable firewalld.service
systemctl disable firewalld.service
systemctl is-enabled firewalld.service
systemctl list-unit-files|grep enabled
systemctl --failed
总结:firewalld-cmd配置
firewall-cmd --version
firewall-cmd --help
firewall-cmd --state
firewall-cmd --zone=public --list-ports
firewall-cmd --reload
firewall-cmd --get-active-zones
firewall-cmd --get-zone-of-interface=eth0
firewall-cmd --panic-on
firewall-cmd --panic-off
firewall-cmd --query-panic