Centos 7 使用(Service iptables stop/start)關閉/打開防火牆 Failed to stop iptables.service: Unit iptables.serv

  背景: html

    測試部署NetCore 項目到linux 系統時,窗口顯示項目部署成功;可是本機沒法訪問(linux 在虛擬機上[ centos 7.6] );  以下圖↓linux

    

 

 

   可以相互ping  通,(Xshell 鏈接正常。),在centos 上 也能正常訪問,後來記起在進行linux   安裝成功後,沒有關閉防火牆,初步猜想是因爲沒有關閉防火牆致使,那關閉防火牆不就能夠了?shell

 2、操做centos

   一、打開linux 終端,輸入:  service  iptables stop   ,就提示 標題展現的異常;測試

  

 

 

   二、而後輸入:systemctl stop firewalld   (暫時關閉防火牆)ui

      查看防火牆狀態:systemctl status firewalld   spa

  

 

 

  

  成功了!!!!.net

  3、回顧總結3d

    通過查找發現:在CentOS 7或RHEL 7或Fedora中防火牆由firewalld來管理 ; 若是想要使用 service iptables start/stop 命令,須要下載     iptables-services rest

    一、在 Centos 7 下下載 iptables-services 時,須要執行如下命令

      systemctl stop firewalld     --關閉防火牆  

      systemctl mask firewalld   

       yum install iptables-services   --安裝iptables-services

       systemctl enable iptables    --設置開機啓動

      service iptables save       --保存

    二、操做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

 

查找資料:一、http://www.javashuo.com/article/p-zkkddoes-kt.html

     二、https://blog.csdn.net/c233728461/article/details/52679558/

 若有不合理之處,請你們多多指教。

    若是您以爲本文對您有幫助,歡迎點擊「收藏」按鈕!(/:微笑)歡迎轉載,轉載請註明出處。

相關文章
相關標籤/搜索