關閉服務器上的防火牆:
/etc/init.d/iptables stop
PS:如若訪問不了,有可能是防火牆開啟的原因,則需關閉防火牆
systemctl status firewalld 查看防火牆狀態,如果開啟則需關閉
systemctl stop firewalld 暫時關閉防火牆
systemctl disable firewalld 永久關閉防火牆
【
實際上對防火牆還是不了解,每次虛擬機重啟都需要執行
service iptables stop
systemctl disable firewalld 永久關閉防火牆 也不知道是哪句起了作用!!
】
此處我遇到了問題:
CentOS 7 執行service iptables start出現redirecting to systemctl ...Failed to ...not loaded.
在centOS 7系統中運行
service iptables stop
發現出錯:出現redirecting to systemctl ...Failed to ...not loaded.
解決辦法
1. 使用systemctl
systemctl [start|stop|restart|save|status] iptables.service
2. 安裝iptables-services
切換到root用戶下,執行:
yum install iptables-services
systemctl enable iptables.service //設置開機啟動
之后就可以使用以下指令了:
service iptables [start|stop|restart|save|status]
iptables常用命令
查看是否已經安裝了iptables以及iptables版本號
iptables -V (注意:V是大寫字母V)
關閉iptables
service iptables stop
啟動iptables
service iptables start
重啟iptables
service iptables restart