Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This modification is to support three or more gateways #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

liebo
Copy link

@liebo liebo commented Sep 20, 2013

No description provided.

@ashi009
Copy link
Owner

ashi009 commented Sep 22, 2013

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

@pupie
Copy link

pupie commented May 22, 2014

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

@ashi009
Copy link
Owner

ashi009 commented May 22, 2014

大致看了一下用自定义 formatter 应该是可以的
On May 22, 2014 10:24 AM, "pupie" [email protected] 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//pull/14#issuecomment-43842383
.

@ashi009
Copy link
Owner

ashi009 commented May 22, 2014

#!/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, 石骁毅 [email protected] wrote:

大致看了一下用自定义 formatter 应该是可以的
On May 22, 2014 10:24 AM, "pupie" [email protected] 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//pull/14#issuecomment-43842383
.

@momaer
Copy link

momaer commented Jan 7, 2015

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

@ashi009
Copy link
Owner

ashi009 commented Jan 8, 2015

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

On Wednesday, January 7, 2015, momaer [email protected] wrote:

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

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


Reply to this email directly or view it on GitHub
#14 (comment).

Sent from Gmail Mobile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants