0、前言
Tor 是实现匿名通信的自由软件,由美国非盈利组织 The Tor Project, Inc 开发与维护。其名源于"The Onion Router"的英语缩写。用户可透过 Tor 接达由全球志愿者免费提供,包含 7500 多个中继的覆盖网络,从而达至隐藏用户真实地址、避免网络监控及流量分析的目的。
之前使用 Tor Browser 时,经测试发现入口 IP 基本上都已被墙,需要前置代理才能访问 Tor 网络,这导致使用 Tor Browser 访问网页的延迟非常大。因此尝试实验使用服务器连接 Tor 网络后作为节点。
1、安装 Tor
Arch Linux
1 | pacman -S tor |
Debian/Ubuntu
1 | apt install tor |
CentOS
1 | yum install tor |
2、配置 Tor
配置文件位置:
/etc/tor/torrc
写入:
1 | SOCKSPort 50001 SOCKSPort 50002 SOCKSPort 50003 SOCKSPort 50004 SOCKSPort 50005 SOCKSPort 50006 SOCKSPort 50007 SOCKSPort 50008 SOCKSPort 50009 SOCKSPort 50010 SOCKSPolicy accept 127.0.0.1 SOCKSPolicy reject * NewCircuitPeriod 30 CircuitBuildTimeout 10 ExcludeNodes {cn},{hk},{mo},{kp},{ir},{sy},{pk},{cu},{vn} StrictNodes 1 |
然后启动:
1 | systemctl enable tor --now |
3、配置 XrayR
路由配置文件:
/etc/XrayR/route.json
写入:
1 | { "domainStrategy": "IPOnDemand", "rules": [ { "network": "tcp", "type": "field", "outboundTag": "socks" } ] } |
出站配置文件:
/etc/XrayR/custom_outbound.json
写入:
1 | [ { "tag": "socks", "protocol": "socks", "settings": { "servers": [ { "address": "127.0.0.1", "port": 50001 }, { "address": "127.0.0.1", "port": 50002 }, { "address": "127.0.0.1", "port": 50003 }, { "address": "127.0.0.1", "port": 50004 }, { "address": "127.0.0.1", "port": 50005 }, { "address": "127.0.0.1", "port": 50006 }, { "address": "127.0.0.1", "port": 50007 }, { "address": "127.0.0.1", "port": 50008 }, { "address": "127.0.0.1", "port": 50009 }, { "address": "127.0.0.1", "port": 50010 } ] } }, { "tag": "IPv4_out", "protocol": "freedom", "settings": {} }, { "tag": "IPv6_out", "protocol": "freedom", "settings": { "domainStrategy": "UseIPv6" } }, { "protocol": "blackhole", "tag": "block" } ] |
在 /etc/XrayR/config.yml
中取消上述两个路径前的注释,重启 XrayR 即可生效。
4、验证
访问 www.cloudflare.com/cdn-cgi/trace
,会看到类似信息;
1 | fl=75f162 h=www.cloudflare.com ip=x.x.x.x ts=1732xxxxxx.xx visit_scheme=http uag=Mozilla/5.0 (Linux; Android XX) AppleWebKit/XXX (KHTML, like Gecko) Chrome/XXX Mobile Safari/XXX colo=XXX sliver=none http=http/1.1 loc=T1 tls=off sni=off warp=off gateway=off rbi=off kex=none |
其中 loc=T1
代表启用了 Tor。
XrayR 配置多个 Tor 轮询出站
评论