預設防火牆firewall #停止firewall systemcl stop firewall.service #禁止firewall開機啟動 systemctl disable firewall.service 查看firewall狀態 firewall-cmd --state 防火牆iptab ...
預設防火牆firewall
#停止firewall
systemcl stop firewall.service
#禁止firewall開機啟動
systemctl disable firewall.service
查看firewall狀態
firewall-cmd --state
防火牆iptables
使用yum下載安裝iptables,進行規則配置
vi /etc/sysconfig/iptables
這裡我們開放8080,80埠,添加配置
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT
保存後重啟iptables服務
systemctl restart iptables.service
#設置iptables開機啟動
systemctl enable iptables.service