0

I have a ssh-enabled machine on my home wifi that I am able to ssh into. I recently got the Linux Subsystem for Windows and I want to remotely ssh into that as well. Both machines have an static ip assigned from my router, but ssh communicates over port 22. 1st question: How does ssh determine which machine I want to access and, 2nd question: How to specify which machine I want to ssh to?

I know putty works in general, which is fine, but I'm probably a little confused as to how ssh works and how it separates different machines on the same network...

Thanks!

closed as too broad by Timothy Martin, user181255, G-Man, mdpc, Michael Homer Jan 20 '18 at 3:29

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Different machines -> different IPs. Think of a computer's IP Address as a house address. The port would be which door or window to enter. But if you mean remotely as in outside your home network, you will need a much deeper understanding of networking to properly configure your router to allow remote connections. – Deathgrip Jan 19 '18 at 22:05
  • I'm voting to close this question as off-topic because it belongs to network engineering. – Tomasz Jan 19 '18 at 22:27
0

As you state in your question, each machine has an IP assigned by the router. That's the address SSH is connecting to. 22 is the default SSH port, but this can be changed within the machine running the server (receiving connections). And the pair IP:port is the full address that needs to be supplied to the SSH client (SSH program that connects to the server).

You should connect to the machine not the router. The router has its own IP. You'd use it to redirect the traffic from outside that router's subnet. In that case you need two different forwards. For example 22 redirecting to Linux's 22 and 2222 forwarding to Windows' 22.

  • Ok cool. Also, I'm trying to remotely ssh into these machines. The way I'm currently doing that is sshing into my router in Port 22 which forwards me to my current machine on my network. If I want to add another device on the same network, I need to change the port that ssh gets to on that machine? – pianoman102 Jan 19 '18 at 22:06
  • @pianoman102 See my updated answer (second paragraph). – Tomasz Jan 19 '18 at 22:15
  • Gotcha. I think that's what I'm looking for. Do i have to configure the windows side to receive that? Or just do the command differently? For example, ssh username@ip:port? – pianoman102 Jan 19 '18 at 23:16
  • @pianoman102 You need an SSH server running on Windows. In server's configuration the port is defined. Then if necessary set the port forwarding in the router. That's all. – Tomasz Jan 19 '18 at 23:20
  • Awesome. And it would need to forward to port 2222, yeah? – pianoman102 Jan 19 '18 at 23:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.