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

2018-12-23 03:02:58 +08:00
 axiauk
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
867 次点击
所在节点    DNS
7 条回复
mytsing520
2018-12-23 03:17:53 +08:00
使用 ip6tables 来配置 IPv6 的规则
axiauk
2018-12-23 04:06:06 +08:00
新手,不会写啊。
lunksana
2018-12-23 08:53:13 +08:00
什么代理软件可以代理 ICMP?
leoleoasd
2018-12-23 10:43:30 +08:00
@lunksana #3 没有吧
ICKelin
2018-12-23 12:32:29 +08:00
@lunksana 代理 ICMP 其实是可以的,但是可能 to c 的产品做的会比较少。
axiauk
2018-12-23 16:07:17 +08:00
我用 xx 可以这样 icmp 可以 ping
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

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/520105

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX