ashi009 / bestroutetb

Generating the most optimized route table for VPN users.
MIT License
879 stars 99 forks source link

This modification is to support three or more gateways #14

Open liebo opened 10 years ago

ashi009 commented 10 years ago

Thanks for your contribution. I'll review the code soon (but very unlikely before Oct 1st.)

pupie commented 10 years ago

https://gist.github.com/wen-long/8644243 参考这个gist,请问bestroute有没有方法生成shadowsocks的ss-redir透明模式的iptalbes?(针对中国IP过滤默认不走代理)

ashi009 commented 10 years ago

大致看了一下用自定义 formatter 应该是可以的 On May 22, 2014 10:24 AM, "pupie" notifications@github.com wrote:

https://gist.github.com/wen-long/8644243

参考这个gist,请问bestroute有没有方法生成shadowsocks的ss-redir透明模式的iptalbes?(针对中国IP过滤默认不走代理)

— Reply to this email directly or view it on GitHubhttps://github.com/ashi009/bestroutetb/pull/14#issuecomment-43842383 .

ashi009 commented 10 years ago
#!/bin/sh

./generate.sh route.sh \
  --net=cn,hk,kr,gb,de,it,0.0.0.0/0, \
  --vpn=us,ie \
  --nodefaultgw=1 \
  --profile=custom \
  --header="#!/bin/sh
iptables -t nat -N SHADOWSOCKS
# 在 nat 表中创建新链
iptables -t nat -A SHADOWSOCKS -p tcp --dport 23596 -j RETURN
# 23596 是 ss 代理服务器的端口,即远程 shadowsocks 服务器提供服务的端口,如果你有多个 ip 可用,但端口一致,就设置这个

iptables -t nat -A SHADOWSOCKS -d 123.456.789.111 -j RETURN
# 123.456.789.111 是 ss 代理服务器的 ip, 如果你只有一个 ss服务器的 ip,却能选择不同端口,就设置此条

iptables -t nat -A SHADOWSOCKS -d 0.0.0.0/8 -j RETURN
iptables -t nat -A SHADOWSOCKS -d 10.0.0.0/8 -j RETURN
iptables -t nat -A SHADOWSOCKS -d 127.0.0.0/8 -j RETURN
iptables -t nat -A SHADOWSOCKS -d 169.254.0.0/16 -j RETURN
iptables -t nat -A SHADOWSOCKS -d 172.16.0.0/12 -j RETURN
iptables -t nat -A SHADOWSOCKS -d 192.168.0.0/16 -j RETURN
iptables -t nat -A SHADOWSOCKS -d 224.0.0.0/4 -j RETURN
iptables -t nat -A SHADOWSOCKS -d 240.0.0.0/4 -j RETURN
iptables -t nat -A SHADOWSOCKS -p tcp -j REDIRECT --to-ports 7777
# 7777 是 ss-redir 的监听端口,ss-local 和 ss-redir 的监听端口不同,配置文件不同
iptables -t nat -I PREROUTING -p tcp -j SHADOWSOCKS
# 在 PREROUTING 链前插入 SHADOWSOCKS 链,使其生效" \
  --format="iptables -t nat -A SHADOWSOCKS -d %prefix/%length -j %gw" \
  --netgw=RETURN \
  --vpngw=ACCEPT

大概可以用

On Thu, May 22, 2014 at 11:27 AM, 石骁毅 ashi009@gmail.com wrote:

大致看了一下用自定义 formatter 应该是可以的 On May 22, 2014 10:24 AM, "pupie" notifications@github.com wrote:

https://gist.github.com/wen-long/8644243

参考这个gist,请问bestroute有没有方法生成shadowsocks的ss-redir透明模式的iptalbes?(针对中国IP过滤默认不走代理)

— Reply to this email directly or view it on GitHubhttps://github.com/ashi009/bestroutetb/pull/14#issuecomment-43842383 .

momaer commented 9 years ago

--vpngw=ACCEPT表示应该通过vpn代理的,结果直接放行了。不是应该redirect吗?我试着把这些redirect。但不工作。 我觉得,因为vpn可以使用最优route,所以这个是没有问题的。但iptables可不管。我现在使用chnroutes来生成中国的ip规则,虽然量比bestroutetb大,但没感觉到影响到效率。

ashi009 commented 9 years ago

对于iptables可能需要将规则倒置才能实现,如果iptables是顺序匹配规则的话就需要这样做了

On Wednesday, January 7, 2015, momaer notifications@github.com wrote:

--vpngw=ACCEPT表示应该通过vpn代理的,结果直接放行了。不是应该redirect吗?我试着把这些redirect。但不工作。

我觉得,因为vpn可以使用最优route,所以这个是没有问题的。但iptables可不管。我现在使用chnroutes来生成中国的ip规则,虽然量比bestroutetb大,但没感觉到影响到效率。

— Reply to this email directly or view it on GitHub https://github.com/ashi009/bestroutetb/pull/14#issuecomment-69015658.

Sent from Gmail Mobile