DNS 已经解决 IPV4+IPV6 但是 iptables 怎么解决啊,谁能帮完善一下 ipv4+ipv6 脚本? - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
axiauk
V2EX    DNS

DNS 已经解决 IPV4+IPV6 但是 iptables 怎么解决啊,谁能帮完善一下 ipv4+ipv6 脚本?

  •  
  •   axiauk 2018-12-23 03:02:58 +08:00 1656 次点击
    这是一个创建于 2540 天前的主题,其中的信息可能已经有所发展或是发生改变。
    debian 9 脚本如下只有 IPV4:使用这个文件 /root/bin/cn_rules_ipv6.conf,谁能帮完善一下 ipv4+ipv6 脚本?


    #!/bin/bash
    SOCKS_SERVER=xxx.xxx.xxx.xxx
    ipset -N chnroute hash:net maxelem 65536
    for ip in $(cat '/root/bin/cn_rules.conf'); do
    ipset add chnroute $ip
    done

    iptables -t nat -N GFWNET
    iptables -t nat -A GFWNET -d $SOCKS_SERVER -j RETURN
    iptables -t nat -A GFWNET -d 0.0.0.0/8 -j RETURN
    iptables -t nat -A GFWNET -d 10.0.0.0/8 -j RETURN
    iptables -t nat -A GFWNET -d 127.0.0.0/8 -j RETURN
    iptables -t nat -A GFWNET -d 169.254.0.0/16 -j RETURN
    iptables -t nat -A GFWNET -d 172.16.0.0/12 -j RETURN
    iptables -t nat -A GFWNET -d 192.168.0.0/16 -j RETURN
    iptables -t nat -A GFWNET -d 224.0.0.0/4 -j RETURN
    iptables -t nat -A GFWNET -d 240.0.0.0/4 -j RETURN

    iptables -t nat -A GFWNET -p tcp -m set --match-set chnroute dst -j RETURN
    iptables -t nat -A GFWNET -p icmp -m set --match-set chnroute dst -j RETURN

    iptables -t nat -A GFWNET -p tcp -j REDIRECT --to-port 1080
    iptables -t nat -A GFWNET -p icmp -j REDIRECT --to-port 1080
    iptables -t nat -A OUTPUT -p tcp -j GFWNET
    iptables -t nat -A OUTPUT -p icmp -j GFWNET
    iptables -t nat -A PREROUTING -s 192.168/16 -j GFWNET
    iptables -t nat -A POSTROUTING -s 192.168/16 -j MASQUERADE
    7 条回复    2019-01-05 22:53:32 +08:00
    mytsing520
        1
    mytsing520  
    PRO
       2018-12-23 03:17:53 +08:00
    使用 ip6tables 来配置 IPv6 的规则
    axiauk
        2
    axiauk  
    OP
       2018-12-23 04:06:06 +08:00
    新手,不会写啊。
    lunksana
        3
    lunksana  
       2018-12-23 08:53:13 +08:00 via Android
    什么代理软件可以代理 ICMP?
    leoleoasd
        4
    leoleoasd  
       2018-12-23 10:43:30 +08:00
    @lunksana #3 没有吧
    ICKelin
        5
    ICKelin  
       2018-12-23 12:32:29 +08:00
    @lunksana 代理 ICMP 其实是可以的,但是可能 to c 的产品做的会比较少。
    axiauk
        6
    axiauk  
    OP
       2018-12-23 16:07:17 +08:00
    我用 xx 可以这样 icmp 可以 ping
    lqs
        7
    lqs  
       2019-01-05 22:53:32 +08:00
    wget https://gist.githubusercontent.com/lqs/22ea1087a8f162fc2d81c52e4ed6e6f7/raw/cd1b5241f4ec7bde389281b17dff409443bc57e2/gistfile1.txt -O ipset6.txt

    ipset restore <ipset6.txt

    ip6tables -t nat -A PREROUTING -d 2000::/3 -p tcp -m set ! --match-set CN6 dst -j REDIRECT --to-port 1080
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     2665 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 23ms UTC 05:50 PVG 13:50 LAX 21:50 JFK 00:50
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86