|
楼主 |
发表于 2013-10-28 00:25
|
显示全部楼层
关于redsocks透明科学上网的配置。
修改/opt/etc/redsocks.conf为如下内容:
- base {
- log_debug = off;
- log_info = off;
- daemon = on;
- redirector = iptables;
- }
-
- redsocks {
- local_ip = 192.168.1.1;
- local_port = 1081;
- ip = 192.168.1.1;
- port = 9050;
- type = socks5;
- autoproxy = 1;
- }
复制代码 /opt/sbin/redsocks -c /opt/etc/redsocks.conf
注意 port和type请根据情况修改,我这里是配合shadowsocks用的。shadowsocks的配置文件很简单,不多说了。也可以用ssh tunnel。type请在socks4, socks5, http-connect, http-relay和direct中选择。
注意,asuswrt-merlin本身就支持iptables,所以不需要安装其它的东西。直接执行下面的命令:
- iptables -t nat -N REDSOCKS
- iptables -t nat -A PREROUTING -i br0 -p tcp -j REDSOCKS
- # Do not redirect traffic to the followign address ranges
- iptables -t nat -A REDSOCKS -d 127.0.0.0/8 -j RETURN
- iptables -t nat -A REDSOCKS -d 192.168.0.0/16 -j RETURN
- iptables -t nat -A REDSOCKS -d 10.8.0.0/16 -j RETURN
- iptables -t nat -A REDSOCKS -d 224.0.0.0/4 -j RETURN
- iptables -t nat -A REDSOCKS -d 240.0.0.0/4 -j RETURN
- # Redirect normal HTTP and HTTPS traffic
- iptables -t nat -A REDSOCKS -p tcp --dport 80 -j REDIRECT --to-ports 1081
- iptables -t nat -A REDSOCKS -p tcp --dport 443 -j REDIRECT --to-ports 1081
复制代码 注意第二行里的 -i br0,我不知道其它机器是什么,rt-n16是br0,可以用ifconfig查看下。
这样就可以了,只要shadowsocks的服务正常,那么路由器下面的机器不需要做任何设置,就和gfw不存在一样。(可能dns还需要做一些设置,不过我是用我自己架的dns,不需要额外的设置)。
安装goagent,用opkg install goagent即可,相关依赖会装的。然后修改/opt/goagent/proxy.ini文件(请自行查看相关说明)后,执行gae &即可。 |
|