-2

I have an home server running on ubuntu server and I want to connect to it with ssh via the external IP with my laptop in the same local network.

I want to do this:

enter image description here

In this case the gateway (my router) forwards external Port 22165 to 192.168.0.165 on Port 22 to communicate with the correct server:

enter image description here

When I want to connect with ssh on windows it times out:

C:\Users\andri> ssh -vvv user@46.x.x.x -p 22165

OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug3: Failed to open file:C:/Users/andri/.ssh/config error:2
debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2
debug2: resolve_canonicalize: hostname 46.x.x.x is address
debug2: ssh_connect_direct
debug1: Connecting to 46.x.x.x [46.x.x.x] port 22165.
debug3: finish_connect - ERROR: async io completed with error: 10060, io:000002148F1B4A00
debug1: connect to address 46.x.x.x port 22165: Connection timed out
ssh: connect to host 46.x.x.x port 22165: Connection timed out

I always connected to it via the external IP and it worked. I also hosted an nginx webserver on it and I think it doesn't work anymore since I stopped the nginx server. Can't tell what I did wrong, but maybe I changed something in some config files but I can't remember which one and I don't know how to find the problem.

My question: How to connect to my server, which is in the same network as my client, via the external/public IP address?


Other information

  • On external network with external IP: Connection works
  • On internal network with internal IP: Connection works
  • Pinging 46.x.x.x works
puncher
  • 97
  • 1
  • You really do not want to add an extra burden to your router for NAT translations, nor do you want to waste the router LAN interface bandwidth (both incoming and outgoing) by doing hairpin routing. You should keep local traffic local and use the local addressing. If you are using DNS, then set your local DNS to use the local address, not the outside address. – Ron Maupin Sep 17 '22 at 19:25

0 Answers0