Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] No connection with Google cloud VPS #363

Open
2 tasks done
Vicio59 opened this issue May 14, 2024 · 12 comments
Open
2 tasks done

[Bug] No connection with Google cloud VPS #363

Vicio59 opened this issue May 14, 2024 · 12 comments

Comments

@Vicio59
Copy link

Vicio59 commented May 14, 2024

Verify steps

  • Is this something you can debug and fix? Send a pull request! Bug fixes and documentation fixes are welcome.
  • 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

@xjasonlyu
Copy link
Owner

Can you test with curl -v 1.1.1.1 for example to see if your tun2socks container works with tcp/http request first?

@Vicio59
Copy link
Author

Vicio59 commented May 14, 2024

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

@xjasonlyu
Copy link
Owner

yea, looks like it's not a DNS issue.

@Vicio59
Copy link
Author

Vicio59 commented May 14, 2024

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

@xjasonlyu
Copy link
Owner

Did you try to bind it to a correct interface?

@Vicio59
Copy link
Author

Vicio59 commented May 14, 2024

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?

@xjasonlyu
Copy link
Owner

Can you confirm your proxy works inside the tun2socks container?

@Vicio59
Copy link
Author

Vicio59 commented May 14, 2024

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

@xjasonlyu
Copy link
Owner

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.

@Vicio59
Copy link
Author

Vicio59 commented May 15, 2024

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?

@xjasonlyu
Copy link
Owner

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.

@Vicio59
Copy link
Author

Vicio59 commented May 15, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants