Use Asuswrt Merlin as a transparent proxy, powered by V2Ray
MIT License
The maintainer using Xray
+ side router
solution daily.
Other solution will not be updated in time may not work at all.
This project is several scripts for config you ASUS router(merlin based) or Side router(A very old linux laptop) to serve as a transparent forward proxy.
Since 2023-07-16, this project's release version just follow Xray-core's version. Since 2024-01-07, the default deploy use Xray + Reality.
For transparent proxy, current only tproxy mode mode is supported, can be used with fakedns optionally.
NOTICE
redirect mode is possible, check script ./deploy_router_use_direct
, dnsmasq serve as LAN DNS server, you only need this if you have a very old ASUS router which not support tproxy.
Even, can always select side router + router
for any (old) router.
You can always check weather router support TProxy use:
# modprobe xt_TPROXY
You can try switch to use fakedns based transparent proxy after deploy successful like this:
$: ./use_fakedns [email protected]
and switch back use:
$: ./use_auto_proxy [email protected]
For better performance, update your's VPS linux kernel to a more recently version (>= 4.9) is encouraged, script can enable BBR for you on this case.
Download script from release page
We assume your's linux VPS IP is 34.80.108.8
, your's router IP is 192.168.50.1
.
Test on CentOS 8, Ubuntu 18.0.4, Debian GNU/linux 9.
By default, use Xray + Reality, you need expose port 22334/22335 for listen on vless/shadowsocks
╰─ $ ./deploy_server root@$hk
sending incremental file list
xray_server.json
2.31K 100% 914.06kB/s 0:00:00 (xfr#1, to-chk=0/1)
......
Run ./deploy_router [email protected] to deploy to router.
Run ./deploy_side_router root@side_router_ip to deploy to side_router.
Previous step will create a new xray client config with binary for you in downloaded_binary/$your_router_arch/
. the default router arch is linux-arm-v5 for ASUS AC-5300, you can override with export router_arch=YOUR_ROUTER_ARCH, for the correct Arch name, check https://github.com/XTLS/Xray-core/releases assets
Then, run following command will deploy Xray transparent proxy to your's local ASUS router automatically.
./deploy_router [email protected]
Run following command will deploy files in downloaded_binary/amd64
to a side router.(for me, it is a HP 2530p laptop + CentOS 8)
./deploy_side_router [email protected]
A success deploy on router should be looking like this.
You can run following command on router
/opt/etc/toggle_proxy.sh
is used for disable/enable proxy temporary, for disable completely, you need chmod -x /opt/etc/patch_router
/opt/etc/patch_router
basically, just disable proxy, and then enable it.
/opt/etc/update_geodata.sh
is used for update geosite data.
/opt/etc/apply_iptables_rule.sh
/opt/etc/clean_iptables_rule.sh
for enable/clean iptables rule.
/opt/etc/check_google_use_socks5
check xray connection if works. (not work for fakeDNS mode)
/opt/etc/check_google_use_proxy
check transparent proxy if works in (side)router. (not work for fakeDNS mode)
telnet 127.0.0.1 22334
telnet {yours.vpsip} 22334
,vless id
, vless port
, domain name
correct../check_google_use_socks5.sh
, ensure it work before test transparent proxy.git checkout -b my-new-feature
.git commit -am 'Add some feature'
.git push origin my-new-feature
.