Iptables开启及关闭 IP和端口

  1. 允许、禁止IP访问

     # 允许
     iptables -A INPUT -s [ip] -j ACCEPT
     service iptables save
     # 禁止
     iptables -A INPUT -s [ip] -j DROP
     service iptables save
    
  2. 允许、禁止端口访问

     # 允许
     iptables -A INPUT -p tcp --dport [端口] -j ACCEPT
     iptables -A OUTPUT -p tcp --sport [端口] -j ACCEPT
     service iptables save
     # 禁止
     iptables -A INPUT -p tcp --dport [端口] -j DROP
     iptables -A OUTPUT -p tcp --sport [端口] -j DROP
     service iptables save
    
@耿志环 2012-∞ 冀ICP备17033181号, powered by Gitbook修订: 2019-07-08 16:49:59

results matching ""

    No results matching ""