• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • iptables允許部分網段

    發表于:2007-07-04來源:作者:點擊數: 標簽:
    #!/bin/bash #edit by luweinet at Apr 27 2005 ,just for allow which ip/net to access the server #you must make sure the allowip.txt is exits. or it just allow hhstu net~~ export PATH=PATH:/sbin:/usr/sbin:/bin iptables=/sbin/iptables dev=bon

    #!/bin/bash
    #edit by luweinet at Apr 27 2005 ,just for allow which ip/net to aclearcase/" target="_blank" >ccess the server
    #you must make sure the allowip.txt is exits. or it just allow hhstu net~~
    export PATH=$PATH:/sbin:/usr/sbin:/bin
    iptables="/sbin/iptables"
    dev=bond0
    allowip=/home/kernel/allowip.txt
    inet=202.197.*.*
    $iptables -F
    $iptables -X
    $iptables -Z
    $iptables -P FORWARD DROP
    $iptables -P INPUT DROP
    $iptables -P OUTPUT DROP
    modprobe ip_tables
    modprobe ip_conntrack
    modprobe ip_conntrack_ftp
    modprobe ipt_state
    #set state
    $iptables -N STATE
    $iptables -A STATE -m state --state INVALID -j DROP
    $iptables -A STATE -m state --state RELATED,ESTABLISHED -j ACCEPT
    #check flags
    $iptables -N FLAGS
    $iptables -A FLAGS -p tcp --tcp-flags ALL FIN,URG,PSH -j DROP
    $iptables -A FLAGS -p tcp --tcp-flags SYN,RST SYN,RST -j DROP
    $iptables -A FLAGS -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP
    $iptables -A INPUT -i $dev -s 10.0.0.0/8 -j DROP
    $iptables -A INPUT -i $dev -s 192.168.0.0/16 -j DROP
    #$iptables -A INPUT -i lo -j ACCEPT
     
    #$iptables -A INPUT -d 59.70.16.0/20 -j ACCEPT  # always allow hhstu
    $iptables -A INPUT -s 202.197.208.0/20 -j ACCEPT
    $iptables -A OUTPUT -d 202.197.208.0/20 -j ACCEPT
     
    $iptables -A INPUT -s 59.70.16.0/20 -j ACCEPT
    $iptables -A OUTPUT -d 59.70.16.0/20 -j ACCEPT
     
    #allow other which at /home/kernel/allowip.txt
            for ip in `cat $allowip`
             do
                    $iptables -A INPUT -s $ip -d $inet -j ACCEPT
                    $iptables -A OUTPUT -d $ip -s $inet -j ACCEPT
            done
     
     
    #$iptables -A INPUT -f -m limit --limit 100/s --limit-burst 300 -j ACCEPT
    if [ -e /proc/sys/net/ipv4/conf/all/accept_source_route ]; then
       for i in /proc/sys/net/ipv4/conf/*/accept_source_route; do
       echo "0" > $i;
       done
    fi
     
    /etc/init.d/iptables save
    /etc/init.d/iptables restart

    # 缺點是鏈太亂,不過能實現那功能~~
     

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>