zoukankan      html  css  js  c++  java
  • iptables常用配置

    常用的iptables模板

    #!/bin/sh
    iptables -F
    iptables -X
    iptables -F -t mangle
    iptables -t mangle -X
    iptables -F -t nat
    iptables -t nat -X
    
    iptables -P INPUT DROP
    iptables -P OUTPUT ACCEPT
    iptables -P FORWARD ACCEPT
    iptables -A INPUT -i lo -j ACCEPT
    iptables -A OUTPUT -o lo -j ACCEPT
    
    iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
    #在所有网卡上打开ping功能,便于维护和检测。
    iptables -A INPUT -i eth+ -p icmp --icmp-type 8 -j ACCEPT
    iptables -A OUTPUT -o eth+ -p icmp --icmp-type 0 -j ACCEPT
    #打开222端口
    iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
    #打开23021端口
    iptables -A INPUT -p tcp -m tcp --dport 23021:23051 -j ACCEPT
    #限制连往本机的web服务,1个C段的IP的并发连接不超过100个,超过的被拒绝:
    iptables -I INPUT -p tcp --dport 80 -m connlimit --connlimit-above 100 --connlimit-mask 24 -j REJECT
    #限制连往本机的telnet单个IP并发连接为2个,超过的连接被拒绝:
    iptables -I INPUT -p tcp --dport 23 -m connlimit --connlimit-above 2 -j REJECT
     
     

     关于防止DDOS攻击方面,简易方法参考:https://www.cnblogs.com/sunky/p/6751412.html

    参考资料:

    iptables详解 http://www.zsythink.net/archives/1199

  • 相关阅读:
    代码编译时JDK版本和运行时JDK版本不一致启动项目报错
    Apache 环境变量配置
    Android NDK 环境变量配置
    Android SDK 环境变量配置
    JAVA 环境变量配置
    FFmpeg Download
    JAVA SE Download
    VS 2015 Download
    BASS HOME
    C++11的闭包(lambda、function、bind)
  • 原文地址:https://www.cnblogs.com/sunky/p/9417409.html
Copyright © 2011-2022 走看看