转自:http://www.jiawei.me/2016/06/pandorabox.html
PandoraBox透明翻墙代理
昨天入手了一个Chromecast,用不了Shadowsocks等翻墙代理,没办法,只能拿出很久以前淘的改内存的Mercury MW305R来提供透明代理。我自己有个budgetvm VPS所以就自己搭一个shadowsocks服务器。
pip install shadowsocks
因为路由器性能有限,推荐使用chacha20加密
锐速官方不提供新安装了,github上有一个破解版锐速,用起来也是极好的。
https://github.com/91yun/serverspeeder
路由器刷了Pandorabox后先安装shadowsocks
opkg install shadowsocks
配置好把/etc/chinadns_chnroute.txt的内容复制到shadowsocks的ip白名单里就可以实现大陆ip绕过模式了。
pip install shadowsocks
因为路由器性能有限,推荐使用chacha20加密
锐速官方不提供新安装了,github上有一个破解版锐速,用起来也是极好的。
https://github.com/91yun/serverspeeder
路由器刷了Pandorabox后先安装shadowsocks
opkg install shadowsocks
配置好把/etc/chinadns_chnroute.txt的内容复制到shadowsocks的ip白名单里就可以实现大陆ip绕过模式了。
打开chromecast试试,什么?还是打不开?电脑也打不开youtube,应该是DNS污染,果然dig www.youtube.com发现是乱七八糟的ip。
路由器安装pdns来自建dns服务器吧
opkg install pdnsd
修改/etc/pdnsd.conf
global {
perm_cache=1024;
cache_dir="/var/pdnsd";
run_as="nobody";
server_port = 1053;
server_ip = 127.0.0.1;
status_ctl = on;
query_method=tcp_only; #注意!tcp_only
min_ttl=15m;
max_ttl=1w;
timeout=10;
}
server {
label= "budgetvm";
ip = ***.***.***.***;#这里填支持tcp获取dns的服务器,也可以是自建的
root_server = on;
uptest = none;
}
服务器端也安装一个pdnsd
global {
perm_cache=1024;
cache_dir="/var/pdnsd";
run_as="nobody";
server_port = 53;
server_ip = 127.0.0.1;
status_ctl = on;
query_method=tcp_only;
min_ttl=15m;
max_ttl=1w;
timeout=10;
}
server {
label= "budgetvm";
ip = 8.8.8.8;直接用google的吧
root_server = on;
uptest = none;
}
启动后把路由器的dns解析定向到pdnsd
电脑可以打开youtube了,Chromecast还是不行,netstat查了一下,发现chromecast直接查询8.8.8.8了,还是被污染,好吧,那我也dns劫持一下吧。。。
iptables -t nat -A PREROUTING -s 192.168.1.1/24 -p udp --dport 53 -j DNAT --to 192.168.1.1
iptables -t nat -A PREROUTING -s 192.168.1.1/24 -p tcp --dport 53 -j DNAT --to 192.168.1.1
这次成功搞定,不过所有dns全部由外边服务器解析,国内的网站速度跟不上。
到https://github.com/felixonmars/dnsmasq-china-list下载accelerated-domains.china.conf 和 bogus-nxdomain.china.conf 放到 /etc/dnsmasq.d。
echo conf-dir=/etc/dnsmasq.d >/etc/dnsmasq.conf
echo server=/#/127.0.0.1#1053 >/etc/dnsmasq.d/gfwlist.conf
这样就把国内外的dns解析分开了,因为dnsmasq优先匹配详值
记得把这里的dns服务器删除。
至此一个完美的透明代理路由器搞定。
没有评论:
发表评论