How do devices know how to connect a server from a different network using SSH

How do devices know how to connect a server from a different network using SSH
How do devices know how to connect a server from a different network using SSH
2022-05-03 03:52:29 - last edited 2022-05-23 03:50:09

Hi

A SOHO network exists with many devices on it including more then 1 server, several end clients and network switches. Lets say the private IP address for a specific server is 192.168.0.10 we will say the public IP address for the whole network is 11.2.2.11. A device from a different location wants to connect to the specific server mentioned earlier using SSH from 141.10.2.2. With so many devices on the network 11.2.2.11 how does the computer know that 141.10.2.2 wants to communicate with the server at 192.168.0.10? Using putty as an example we know that SSH communicates on port 22, how would the computer know that we want to connect to 192.168.0.10 on the private network and not another one of the servers with SSH setup? Does the person on the private network need to setup SSH to work on different port numbers for each server that is expecting to be remotes into?

For some context i am currently trying to setup a basic Linux server on my own home network and I am confused as to how I would connect to my servers when I am on different networks. I plan to have more then one server and I intend to use virtual machines. I am learning and trying to figure out how i would connect to each server.

  0      
  0      
#1
Options
1 Accepted Solution
Re:How do devices know how to connect a server from a different network using SSH-Solution
2022-05-05 20:50:54 - last edited 2022-05-23 03:50:09

  @JamesZimmerman 

 

Hey

 

This is a common enough question and basically, the answer is different ports.  When enabling SSH you can choose what port the server listens on (default is 22)

 

SSH for example runs on port 22.. lets assume you have 3x servers needing SSH access.

 

Enable SSH on Server 1 with Port 22, Server 2 with Port 23 and Server 4 with Port 24

 

Have the router on your site forward port 22 to server 1, 23 to server 2 etc etc..

 

Client then connects on 11.2.2.11 port 22 for Server 1    OR    11.2.2.11  port 23 for Server 2 etc etc..

 

Simple way to set this up

 

In the few times I have used this setup I have used ports well outside the standard range for SSH... eg  5000  5100  5200 etc

Recommended Solution
  0  
  0  
#2
Options
3 Reply
Re:How do devices know how to connect a server from a different network using SSH-Solution
2022-05-05 20:50:54 - last edited 2022-05-23 03:50:09

  @JamesZimmerman 

 

Hey

 

This is a common enough question and basically, the answer is different ports.  When enabling SSH you can choose what port the server listens on (default is 22)

 

SSH for example runs on port 22.. lets assume you have 3x servers needing SSH access.

 

Enable SSH on Server 1 with Port 22, Server 2 with Port 23 and Server 4 with Port 24

 

Have the router on your site forward port 22 to server 1, 23 to server 2 etc etc..

 

Client then connects on 11.2.2.11 port 22 for Server 1    OR    11.2.2.11  port 23 for Server 2 etc etc..

 

Simple way to set this up

 

In the few times I have used this setup I have used ports well outside the standard range for SSH... eg  5000  5100  5200 etc

Recommended Solution
  0  
  0  
#2
Options
Re:How do devices know how to connect a server from a different network using SSH
2022-05-23 04:03:37

the only thing I don't understand is "in order to establish the connection you should ssh on your local host on port 1337" can you explain omegle.ws a bit more about this?

  0  
  0  
#3
Options
Re:How do devices know how to connect a server from a different network using SSH
2022-05-23 17:16:14

  @JamesZimmerman 

 

"in order to establish the connection you should ssh on your local host on port 1337"

 

If I am reading that correctly it wants you to connect to the ssh on port 1337 using its local address (192.168.x.x)

 

A program like Putty should help you with this, just set the SSH port as 1337

You can download putty for free

  0  
  0  
#4
Options