iptables防火牆操作-查看、配置、重啟、關閉


  • 查看iptables端口配置
    iptables -L -n --line-number
  • iptables端口配置(不開通3389無法遠程連接,不開通icmp無法ping)
    iptables -A INPUT -p tcp --dport 443 -j ACCEPT
    iptables -A OUTPUT -p tcp --sport 443 -j ACCEPT
    iptables -A INPUT -p tcp --dport 3306 -j ACCEPT
    iptables -A OUTPUT -p tcp --sport 3306 -j ACCEPT
    iptables -A INPUT -p tcp --dport 80 -j ACCEPT
    iptables -A OUTPUT -p tcp --sport 80 -j ACCEPT
    iptables -A INPUT -p tcp --dport 22 -j ACCEPT
    iptables -A OUTPUT -p tcp --sport 22 -j ACCEPT
  • iptables刪除端口配置
    iptables -D INPUT 1
  • iptables關閉所有配置
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
  • 重啟iptables
    service iptables save && service iptables restart
  • 關閉防火牆
    chkconfig iptables off && service iptables stop


免責聲明!

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



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