Home » Questions » Computers [ Ask a new question ]

Connecting to home computers behind a router

Connecting to home computers behind a router

I have a home network setup behind a NAT router with two linux boxes. Occasionally, I want to ssh to them from outside the home network, but neither have a public IP address. What's your recommendation?

Asked by: Guest | Views: 273
Total answers/comments: 2
Guest [Entry]

"You can always port forward and use a separate port for each machine. In /etc/ssh/sshd_config Change the line that says:

port 22

to whatever you wish. Different for each machine obviously. You could use 22222 for one and 22223 for the other. Then you can run ssh -p 22222 user@1.2.3.4 for example, or within PuTTY change the port.

Make sure to restart the sshd service after changing this so it re-reads the configuration file"
Guest [Entry]

Easiest would be to change the port SSH listens to on the internal network, and forward those IPs to the correct internal box.