Linux關閉打開防火牆命令


Linux下打開和關閉防火牆

1.及時生效,重啟后復原

關閉:service iptables stop  開啟:service iptalbes start  查看狀態:service iptables status(關閉狀態的話會提示firewal is not running)

2.非及時性生效,重啟后永久性生效

關閉:chkconfig iptbales off  開啟:chkconfig iptables on  查看狀態:chkconfig iptables --list

在開啟了防火牆時,做如下設置,開啟相關端口,

修改/etc/sysconfig/iptables 文件,添加以下內容:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM