vote up 3 vote down star
2

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?

Currently, I have setup a dynamic DNS record for the router, which reroutes all remote connections to one server. If I do want to ssh to the other server, I first ssh to the first server, and then ssh from the first to the second.

Is there an option to connect to either of the servers directly through ssh tunneling or virtual domains and such?

flag

75% accept rate

3 Answers

vote up 6 vote down check

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

link|flag
vote up 0 vote down

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

link|flag
vote up 0 vote down

The router should be programmed too.

link|flag

Your Answer

Get an OpenID
or
never shown

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