localtunnel / server

server for localtunnel.me
https://localtunnel.me
MIT License
3.05k stars 987 forks source link

Error: connection refused: subdomain.host.com:41765 (check your firewall settings) #123

Open hailwood opened 4 years ago

hailwood commented 4 years ago

We've setup a local tunnel server,

However when attempting to connect we're getting the following

your url is: http://subdomain.host.com
/home/matthew/.npm-packages/lib/node_modules/localtunnel/bin/client:65
        throw err;
        ^

Error: connection refused: subdomain.host.com:41765 (check your firewall settings)
    at Socket.<anonymous> (/home/matthew/.npm-packages/lib/node_modules/localtunnel/lib/TunnelCluster.js:47:32)
    at Socket.emit (events.js:198:13)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)

On the server logs with debug enabled we're getting

2019-11-14T20:44:38.270Z lt:TunnelAgent[subdomain] tcp server listening on port: 41765
2019-11-14T20:44:39.270Z lt:ClientManager removing client: subdomain
2019-11-14T20:44:39.270Z lt:TunnelAgent[subdomain] closed tcp socket
2019-11-14T20:44:39.270Z lt:TunnelAgent[subdomain] closed tcp socket

So what I'm not sure is, is that the client failing to connect to the server on that port? What's the expected port range we should have open?

nnajiabraham commented 4 years ago

Hi any idea if you were able to resolve this?

hailwood commented 4 years ago

Nope, still no idea sorry

FransBCocq commented 3 years ago

I'm encountering the same issue in a specific test scenario, where I try to traverse through Carrier Grade NAT (CGN). Therefore I set up the following GNS3 virtual network environment with some new findings, which might be interesting for you.

image

"Raspi-A-1" in the field hangar network is running the localtunnel client, which connects to "Proxy-1" in the home network, which runs the localtunnel server. This connection doesn't work and crashes immediately with the same error as @hailwood postet in this thread. For test purposes I made an exact copy of the "Proxy-1", called "CloneofProxy-1" and put it right next to the "Raspi-A-1" inside the same local subnet and this connection works flawlessly for some reason. So it seems that a connection to a different network with routers in between doesn't work with the current implementation of the localtunnel server. I also deployed the localtunnel server outside of this GNS3 environment on another VM with direct internet access to it, which doesn't work either, same with the docker container implementation.

Edit: The localtunnel client on the "Raspi-A-1" seems to be fine, because establishing and maintaining a connection to the public localtunnel.me server works.

Any ideas what is causing this strange behaviour?

StyleT commented 3 years ago

Hi! Look at this comment https://github.com/localtunnel/server/issues/146#issuecomment-783241860

brunovianna commented 3 years ago

just a comment: check your lan (home or company) router to see if the ports above 1024 are open. i was using it from a library and it didn't work. when i connected through a mobile phone hotspot to test, it worked fine,