centos7啓動iptables時報

centos7啓動iptables時報Job for iptables.service failed because the control process exited with error cod

 

 service iptables start

報錯如下:

Job for iptables.service failed because the control process exited with error code. See "systemctl status iptables.service" and "journalctl -xe" for details.

查看異常信息:

journalctl -xe

錯誤如下:

Failed to start IPv4 firewall with iptables.

解決辦法

因爲centos7默認的防火牆是firewalld防火牆,不是使用iptables,因此需要先關閉firewalld服務,或者乾脆使用默認的firewalld防火牆。

因爲這次報錯的服務器是一臺剛剛購買的阿里雲服務器,所以在操作上忘記關閉默認防火牆的步驟了才導致浪費了些時間在這件事情上。

關閉firewalld:


 
  1. systemctl stop firewalld

  2. systemctl mask firewalld

使用iptables服務:


 
  1. #開放443端口(HTTPS)

  2. iptables -A INPUT -p tcp --dport 443 -j ACCEPT

  3.  
  4. #保存上述規則

  5. service iptables save

  6.  
  7. #開啓服務

  8. systemctl restart iptables.service

正常啓動!!!!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章