xjasonlyu / tun2socks

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

[Doc Bug] setup should mention that host can not be localhost and nameserver should be changed #341

Closed sgon00 closed 1 month ago

sgon00 commented 4 months ago

Verify steps

Version

any

What OS are you seeing the problem on?

Linux

Description

I followed https://github.com/xjasonlyu/tun2socks/wiki/Examples to setup environment. But it never works. It took me many days to figure out what's going on. Finally, I figued out:

I don't really care if this documentation issue will be fixed or not. As long as the issue exists, hopefully, it can help other people like me when using this tool.

Thanks a lot.

CLI or Config

No response

Logs

No response

How to Reproduce

No response

xjasonlyu commented 4 months ago

Sorry for the wiki, I understand that it is not very detailed.

To use a localhost socks5 or any kinds of proxy servers, you need to enable the interface bound option for your proxy servers, e.g. v2ray server has a sendThrough option in its outbound settings, which can be used to bind to a specific interface to avoid the infinite loop issue. https://www.v2fly.org/config/outbounds.html#outboundobject

Hope it helps.

sgon00 commented 4 months ago

@xjasonlyu thank you very much for your reply. I just tried sendThrough and tried in many ways. It just doesn't work at all. I think I will only use v2ray proxy in another machine (actually in a VM with bridged nic). Localhost v2ray just causes too much troubles. Cheers.

shakibamoshiri commented 3 months ago

@sgon00 I am facing some similar issues ... #345 what do you mean by this socks5 host can not be localhost. ...

Do you mean it cannot be e.g. 127.0.0.1:PORT ?

sgon00 commented 3 months ago

@shakibamoshiri yeah, it's better not be in the same host. Otherwise, you will need to workaround too many problems. It's better put in another host/computer. I am using a VM for this purpose.

shakibamoshiri commented 3 months ago

Thinking that this app could be the reason for the errors I saw, I complied badvpn and saw the same result.
The issue is not this app, it was SSH socks5 port forwarding that could not forward UDP traffic.

The app (tun2socks) is reliable as I tested with iperf3 with TCP and fast , but in practice opening sites like YouTube which has mixed UDP / TCP requests cases errors

So shortly the issue for me and probably yours are likely UDP requests could not go to socks5 servers. I think I should find an SSH client tool that supports UDP.

xjasonlyu commented 3 months ago

Standard SSH protocol doesn't support UDP. Why not try some real proxy tools like gost?

shakibamoshiri commented 3 months ago

I live in Iran -- the Hell of Internet users , has gotten much worse than China -- regardless of the protocol , that tool should support reverse tunnel , otherwise cannot operate well here .

Today tested wstunnel, which supports UDP and reverse tunnel , works fine, but it is slow comparing to openssh-client This tool (tun2socks) is pretty useful and I think we should update the WiKi to add more realistic examples .

github-actions[bot] commented 1 month 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