解決問題:
Linux是系統部署常用的系統,但是經常由於我們忘記防火牆的存在導致訪問失敗,爲了解決這個問題,我們需要對防火牆進行關閉操作,對於常見的系統我們提供了以下幾種解決方式:
centos 7:
暴力解決 ------ 整體關閉
systemctl stop firewalld & systemctl disable firewalld
systemctl stop firewalld 命令只是臨時關閉防火牆,dsystemctl disable firewalld是永久關閉
優雅關閉 ------ 開啓端口
firewall-cmd --zone=public -add-port=9999/tcp --permanent
firewalld-cmd --reload
查看是否開啓成功:
firewall-cmd --zone=public --list-ports | grep 9999
centos 6:
查看防火牆是否關閉:
service iptables status
暴力解決 ------ 整體關閉
service iptables stop & chkconfig iptables off
優雅關閉 ------ 開啓端口
iptables -A INPUT -p tcp --dport 9999 -j ACCEPT
更多問題可以加公衆號:代碼小棧,期待爲您解決更多問題