赞
踩
[root@VM-0-6-centos /]# firewall -cmd --list -all
-bash: firewall: command not found
因为centos中没有安装firewall
安装firewall
[root@VM-0-6-centos /]# yum install firewalld
启动命令
[root@VM-0-6-centos /]# systemctl start firewalld
停用命令
[root@VM-0-6-centos /]# systemctl stop firewalld
查看状态命令
[root@VM-0-6-centos /]# systemctl status firewalld
开机启动命令
[root@VM-0-6-centos /]# systemctl enable firewalld
开机禁用命令
[root@VM-0-6-centos /]# systemctl disable firewalld
注意:这里执行了开机启动命令和开机禁用命令后发现(粗心大意了!!!)
[root@VM-0-6-centos /]# systemctl status firewall
Unit firewall.service could not be found.
systemctl status firewalld 而不是 systemctl status firewall
yum install firewalld firewall-config
- [root@VM-0-6-centos /]# service firewalld status
- [root@VM-0-6-centos /]# service firewalld start
- [root@VM-0-6-centos /]# service firewalld stop
查看firewall状态
firewall-cmd --state
查看firewall服务状态
systemctl status firewalld.service
查看防火墙规则(查看防火墙开放端口)
firewall-cmd --list-all
防火墙生效
firewall-cmd --reload
添加自定义开放端口(设置完后要让其生效firewall-cmd --reload)
firewall-cmd --zone=public --permanent --add-port=8090/tcp
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。