本文记录OpenWrt设置透明代理的步骤及原理。
透明代理的运行原理主要由DNS访问流程
、IP访问流程
两部分组成组成
flowchart LR
lh((localhost));
dm(Dnsmasq);
cd(ChinaDNS);
hdp(https-dns-proxy);
ss(Shadowsocks);
fd(国外DNS);
dd(国内DNS);
lh -- 1 udp:53 --> dm;
dm -- 2 udp:5555 --> cd;
cd -- 3.1 udp:5353--> hdp;
cd -- 3.2 udp --> dd;
hdp -- 4 tcp --> ss;
ss -- 5 tcp --> fd;
fd -. 6 .-> ss;
ss -. 7 .-> hdp;
hdp -. 8.1 .-> cd;
dd -. 8.2 .-> cd;
cd -. 9 缓存 .-> dm;
dm -. 10 IP地址 .-> lh;
flowchart LR
fs(国外服务器);
ds(国内服务器);
lh((localhost));
route{chinadns_chnroute.txt};
ss(Shadowsocks);
lh -- 1 --> route;
route -- 2.1 国内IP --> ds;
route -- 2.2 国外IP --> ss;
ss -- 3 加密访问 --> fs;
fs -. 4 返回加密数据 .-> ss;
ds -. 5.1 返回数据 .-> lh;
ss -. 5.2 返回解密数据 .-> lh;
服务器管理
-编辑服务器
-插件参数
:一定要加上"loglevel=none",如果不加v2ray-plugin插件几分钟就会被系统杀死访问控制
-被忽略IP列表
:/etc/chinadns_chnroute.txt由于使用了v2ray-plugin 插件,导致Shadowsocks不再支持UDP包,所以使用TCP的方式查询DNS