有時候,在虛擬機(我用的是centos)上面開了服務,在外面訪問不到,本機一切都正常,這時就應該想到防火牆。
關閉防火牆:
首先,我們要知道要關閉的可能還不少,有iptables,firewalld,selinux,下面一個個來關閉;
a1、查看狀態:systemctl status firewalld

a2、關閉: systemctl stop firewalld(事實證明,只執行這個,重啟之后是不行的,還必須執行systemclt disable firewalld)

b1、查看selinux狀態:getenforce

b2、關閉:編輯文件 /etc/selinux/config,將selinux的值改成disable,然后重啟生效(reboot)

c1、查看iptables狀態:systemctl status iptables

c2、centos7 默認是使用firewalld作為防火牆,iptables是關閉狀態,,若要關閉執行命令chkconfig iptables off(永久關閉)
