当前位置:   article > 正文

linux中防火墙操作命令_firewall: command not found

firewall: command not found

[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
  1. [root@VM-0-6-centos /]# service firewalld status
  2. [root@VM-0-6-centos /]# service firewalld start
  3. [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

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/283037
推荐阅读
相关标签
  

闽ICP备14008679号