Closed pmartini closed 1 year ago
Thanks for your feedback! I would like to ask if your proxy server correctly supports the UDP relay. If not, you should try to use one.
However, if you just wanna DNS over tcp or whatsoever, you can install a DoH server locally. That will do all the magic.
我貌似遇到了同样的问题。
ping域名,日志正常显示,但是无法解析
直接curl ip,是可以正常走代理的。
我是部署在docker desktop for window上的。代理是V2rayN,已经开启udp
我不太懂这些,怎么做才能正常dns解析呢?非常感谢
我写了一个脚本发送udp请求,通过代理去解析域名。在v2rayN中是能看到代理udp的相关日志的。
但是tun2socks发送的udp在v2rayN中看不到。好难,搞不懂。
设置了以下内容,可以正常访问网页了。 ip rule add to 8.8.8.8 lookup main ip rule add to 192.168.65.7 lookup main
但是容器内走udp的服务都无法正常代理。
执行 / # echo "hello" | nc -u -w1 192.168.1.100 1234 可以看到日志输出 2023-03-24 19:57:11 time="2023-03-24T11:57:11Z" level=info msg="[UDP] 198.18.0.1:54598 <-> 192.168.1.100:1234" 2023-03-24 19:57:28 time="2023-03-24T11:57:28Z" level=info msg="[UDP] 198.18.0.1:58025 <-> 192.168.1.100:1234"
但是v2rayN中看不到任何信息。正常情况下应该能看到 2023/03/24 19:58:57 [Info] [3137682001] proxy/socks: client UDP connection from udp:127.0.0.1:65099 2023/03/24 19:58:57 [Debug] [3137682001] proxy/socks: send packet to udp:192.168.1.100:1234 with 32 bytes
@Ador-able It's probably your v2ray side's issue. When using UDP behind NAT, you should be careful to configure the right UDP binding address for your socks server.
@xjasonlyu 我使用python PySocks库写了一个测试脚本,其中通过代理发送udp流量,在tun2socks容器内部执行的。使用同样的代理地址,脚本发送的udp流量能被正确代理。经过tun2socks的udp流量 v2ray接收不到
v2ray 有个UDP设置的,你应该是那里没设置对。
是可以正常代理udp流量的
@xjasonlyu
确实是nat后的原因,socks5.go的123行,返回的代理 IP 地址是127.0.0.1,导致udp发错了。是否可以将127.0.0.1这种地址也走一下net.ResolveUDPAddr
这是不符合Socks5 UDP规范的,不应该更改tun2socks的代码,而应该是配置v2ray UDP的时候将监听地址绑定正确。
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
Verify steps
Version
2.4.1
What OS are you seeing the problem on?
Linux
Description
Hello DNS queries are shown in tun2socks log, however dns requests are not resolved at all, neither curl domainname.com (curl: (6) Could not resolve host: ) or nslookup or any other, no response received. If use use raw ip address for http/https queries instead of domain name, everything works fine. To fix this I had to add a route to 8.8.8.8 and 1.1.1.1 server through default enp0s3 interface to prevent routing via tun0, but it leads to dns leaks in browser which is not good. Is there a way to make dns requests work via tun2socks tunnel ? Forcing DNS vis TCP helps on local machine however other machines in 10.10.10.0 network can't be forced to use DNS over TCP.
CLI or Config
ip a
ip route
Logs
How to Reproduce
Download prebuild linux-amd64 binary version 2.4.1 and use on Debian 11 amd64, same if build from source code No response