CentOS7 防火墙相关命令
It has been 916 days since the last update, the content of the article may be outdated.
CentOS7 防火墙相关命令
- 查看防火墙状态
shell
1 | firewall-cmd --state |
- 停止firewall
shell
1 | systemctl stop firewalld.service |
- 开启firewall
shell
1 | systemctl stop firewalld.service |
- 禁止firewall 开机启动
plaintext
1 | systemctl disable firewalld.service |
- 设置开机启动防火墙
plaintext
1 | systemctl enable firewalld.service |
- 重启防火墙
shell
1 | firewall-cmd --reload |
- 对外开放端口
shell
1 | 说明: |
- 关闭对外端口
shell
1 | firewall-cmd --zone=public --remove-port=端口号/tcp --permanent |
- 查看已经对外开放的端口
shell
1 | 设置开放某个端口后,需要重启防火墙,才能看到刚刚开启的端口 |
- 查看防火墙所有相关信息
shell
1 | firewall-cmd --list-all |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 wshawk's blog!