您的位置:首页 > 大数据 > 人工智能

Centos 7 使用(Service iptables stop/start)关闭/打开防火墙 Failed to stop iptables.service: Unit iptables.s...

2020-03-19 20:27 661 查看

https://www.cnblogs.com/skyheaving/archive/2020/02/08/12283656.html


  背景: 

    测试部署NetCore 项目到linux 系统时,窗口显示项目部署成功;但是本机无法访问(linux 在虚拟机上[ centos 7.6] );  如下图↓

    

 

 

   能够相互ping  通,(Xshell 连接正常。),在centos 上 也能正常访问,后来记起在进行linux   安装成功后,没有关闭防火墙,初步猜测是由于没有关闭防火墙导致,那关闭防火墙不就可以了?

 二、操作

   1、打开linux 终端,输入:  service  iptables stop   ,就提示 标题展示的异常;

  

 

 

   2、然后输入:systemctl stop firewalld   (暂时关闭防火墙)

      查看防火墙状态:systemctl status firewalld   

  

 

 

  

  成功了!!!!

  三、回顾总结

    经过查找发现:在CentOS 7或RHEL 7或Fedora中防火墙由firewalld来管理 ; 如果想要使用 service iptables start/stop 命令,需要下载     iptables-services 

    1、在 Centos 7 下下载 iptables-services 时,需要执行以下命令

      systemctl stop firewalld     --关闭防火墙  

      systemctl mask firewalld   

       yum install iptables-services   --安装iptables-services

       systemctl enable iptables    --设置开机启动

      service iptables save       --保存

    2、操作linux 防火墙命令:      

1:查看防火状态
systemctl status firewalld
service  iptables status

2:暂时关闭防火墙
systemctl stop firewalld
service  iptables stop

3:永久关闭防火墙
systemctl disable firewalld
chkconfig iptables off

4:重启防火墙
systemctl enable firewalld
service iptables restart

5:永久关闭后重启(未测试)
chkconfig iptables on

 

查找资料:1、https://www.cnblogs.com/jxldjsn/p/10794171.html

     2、https://www.geek-share.com/detail/2685957520.html

 如有不合理之处,请大家多多指教。

    如果您觉得本文对您有帮助,欢迎点击“收藏”按钮!(/:微笑)欢迎转载,转载请注明出处。

 

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  firewalld iptables linux
相关文章推荐