xjasonlyu / tun2socks

tun2socks - powered by gVisor TCP/IP stack
https://github.com/xjasonlyu/tun2socks/wiki
GNU General Public License v3.0
2.85k stars 404 forks source link

[Bug] How to solve the loopback problem caused by the v2ray rules on Windows #282

Closed luhaoz closed 7 months ago

luhaoz commented 11 months ago

Verify steps

Version

2.5.1

What OS are you seeing the problem on?

Windows

Description

我在把tun2socks 和 v2ray 结合进行使用,我的目标是让所有的本机流量都通过我的v2ray进行访问,目前如果v2ray转发全部流量是很正常的,但是如果我设置某个域名不进行带来直接访问就会造成route loop 我试着把域名的ip加入到route中但是因为很多域名有很多cdn ip 我无法确定全部的ip列表,是否可以通过配置或者某种方案让实现,因为window似乎是没有办法识别域名或者流量来源是某个网卡这样的功能

全部流量 -> tun -> v2ray -> 代理服务器 全部流量 -> tun -> v2ray -> 直接物理网卡

这样的形式呢?

CLI or Config

` .\tun2socks.exe -device tun://tun00 -proxy socks5://127.0.0.1:10808

netsh interface ip set address "tun00" static address=10.10.10.2 mask=255.255.255.0 gateway=10.10.10.1

route add 14.29.193.181 192.168.18.254 metric 5

route add 0.0.0.0 mask 0.0.0.0 10.10.10.1 `

Logs

No response

How to Reproduce

No response

vandykeWei commented 10 months ago

我也遇到这个问题了,不走代理的流量又进入了tun,形成了回环,请问有什么方案可以解决这个问题

xjasonlyu commented 10 months ago

You can solve this kind of issue by binding your v2ray & tun2socks to the same network interface.

github-actions[bot] commented 8 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days