tun2socks
tun2socks copied to clipboard
[Bug] No connection with Google cloud VPS
Verify steps
- [X] Is this something you can debug and fix? Send a pull request! Bug fixes and documentation fixes are welcome.
- [X] I have searched on the issue tracker for a related issue.
Version
latest
What OS are you seeing the problem on?
Linux
Description
Hi, I've been using tun2socks for over a year now and it has never given me any problems. Since I purchased a Google Cloud VPS with debian (where I installed docker and then tun2socks) the connection doesn't work, I tried add google DNS on /etc/resolv.conf file, i tried wget to see if the problem was DNS resolution but even with a IP (example 1.1.1.1) I don't receive anything.
docker exec -it tun2socks5 /bin/sh / # wget -qO- ifconfig.me/ip wget: bad address 'ifconfig.me' / # wget -qO- 1.1.1.1 wget: error getting response: Connection reset by peer
The proxy server works because with other VPS like AWS or Kamatera I can make tun2socks work without problems. The proxy server supports udp among other things. Any suggestions are welcome, thanks
CLI or Config
sudo docker run --name tun2socks --restart=always -e LOGLEVEL=info -e PROXY=socks5://MYUSER:MYPASS@IPPROXYSERVER:1080 -v '/dev/net/tun:/dev/net/tun' --cap-add=NET_ADMIN -d xjasonlyu/tun2socks:latest
Logs
No response
How to Reproduce
No response
Can you test with curl -v 1.1.1.1 for example to see if your tun2socks container works with tcp/http request first?
sudo docker run --name curl --network=container:tun2socks5 curlimages/curl -v 1.1.1.1 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying 1.1.1.1:80...
- Connected to 1.1.1.1 (1.1.1.1) port 80
GET / HTTP/1.1 Host: 1.1.1.1 User-Agent: curl/8.7.1 Accept: /
- Request completely sent off 0 0 0 0 0 0 0 0 --:--:-- 0:00:04 --:--:-- 0* Recv failure: Connection reset by peer 0 0 0 0 0 0 0 0 --:--:-- 0:00:05 --:--:-- 0
- Closing connection curl: (56) Recv failure: Connection reset by peer
yea, looks like it's not a DNS issue.
What could it be? It's the first time I've had a problem with tun2socks, it doesn't seem to work only with Google Cloud VPS, thanks
Did you try to bind it to a correct interface?
In what sense? if I run ifconfig inside the tun2socks container the only interfaces I see are: eth0, lo and tun0. Do you mean if I manually bound the container tun2socks to eth0?
Can you confirm your proxy works inside the tun2socks container?
Do you mean if I tested my proxy by running curl inside the tun2socks container? No, I couldn't do it because curl is not installed inside the tun2socks container, I tried with wget -qO- 1.1.1.1 and failed
Do you mean if I tested my proxy by running curl inside the tun2socks container? No, I couldn't do it because curl is not installed inside the tun2socks container, I tried with wget -qO- 1.1.1.1 and failed
I mean you can install that by running apk install curl, but you'll probably wanna turn off tun2socks process first or so.
Ok, I managed to install curl on the tun2socks container but previously it still didn't work even with curl 1.1.1.1. After playing with the ip rule and ip route rules it seems like it now works with tcp/http requests because curl 1.1.1.1 works, but dns doesn't work. These are my rules and the tests I did:
/ # ip rule
0: from all lookup local
9: from all iif lo ipproto udp dport 53 lookup main
10: from all to MYSERVERIP lookup main
20: from all lookup 20
32766: from all lookup main
32767: from all lookup default
/ # ip route
default via 172.17.0.1 dev eth0
198.18.0.0/15 dev tun0 proto kernel scope link src 198.18.0.1
/ # curl --interface tun0 ifconfig.me
curl: (6) Could not resolve host: ifconfig.me
/ # curl --interface tun0 1.1.1.1
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>cloudflare</center>
</body>
</html>
/ # curl 1.1.1.1
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>cloudflare</center>
</body>
</html>
What could be the problem in your opinion?
No, I mean you can try something like curl -v 1.1.1.1 -x "socks5://your-proxy" --interface eth0
to see if your proxy works inside the container.
ok, I tried with:
/ # curl -v 1.1.1.1 --proxy socks5://MYUSER:MYPASS@SERVERIP:PORT --interface eth0
- Trying SERVERIP:PORT...
- socket successfully bound to interface 'eth0'
After which it stops like this, while I tried the same command directly on the server and it works
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