网站首页 > linux / 正文
防火墙
查看防火墙状态
- centos7
systemctl status firewalld.service
运行上述命令后,如果看到有绿色字样标注的“active(running)”,说明防火墙是开启状态。
开启防火墙
- centos7
systemctl start firewalld.service
关闭防火墙
- centos7
systemctl stop firewalld.service
关闭后,可查看防火墙状态,当显示disavtive(dead)的字样,说明CentOS 7防火墙已经关闭。
但要注意的是,上面的命令只是临时关闭了CentOS 7防火墙,当重启操作系统后,防火墙服务还是会再次启动。如果想要永久关闭防火墙则还需要禁用防火墙服务。
禁用防火墙服务
- centos7
systemctl disable firewalld.service
查看防火墙规则
firewall-cmd –list-all
查询端口是否开放
- centos7
firewall-cmd –query-port=8080/tcp
重启防火墙
firewall-cmd –reload
开放指定(如8080)端口
firewall-cmd –permanent –add-port=8080/tcp
(修改配置后需要重启防火墙)
移除某个防火墙开启的端口
firewall-cmd –permanent –remove-port=8080/tcp
(修改配置后需要重启防火墙)
参数解释:
firewall-cmd: 是Linux提供的操作firewall的一个工具;
–permanent:表示设置为持久;
–add-port:表示添加的端口。
Tags:关闭linux防火墙命令
猜你喜欢
- 2024-11-26 CentOS7 设置防火墙、开放指定端口操作
- 2024-11-26 Linux系统中的防火墙主要有两种
- 2024-11-26 Iptables 教程 – 使用 Linux 防火墙保护 Ubuntu VPS
- 2024-11-26 Centos7版本不能解压*.zip格式文件
- 2024-11-26 什么是linux防火墙?让首批红帽授权认证专家为你详细解答
- 2024-11-26 学习笔记-Linux 防火墙 - Firewall-cmd
- 2024-11-26 Linux防火墙Iptables与Firewalld的学习总结!PDF版可领取
- 2024-11-26 Linux防火墙基础和iptables命令文档,看完终于明白了
- 2024-11-26 linux怎么看防火墙是否开启?删除iptables规则
- 2024-11-26 linux命令-centos7防火墙