Accessing ssh servers behind NAT
Tue, 10/09/2012 - 10:29 — sandipCreate a "config" file in your "~/.ssh" directory with the below contents:
Host server1
Hostname server1.example.com
HostKeyAlias server1
CheckHostIP no
Port 221
Host server2
Hostname server2.example.com
HostKeyAlias server2
CheckHostIP no
Port 222
The key is to set CheckHostIP to "no" and use "HostKeyAlias" to specify an alias that should be used instead of the real host name when looking up or saving the host key in the host key database files.
The Port line avoids having to specify the port when connectig.
Connect to corresponding host via:
$ ssh {user}@server1
$ ssh {user}@server2
- sandip's blog
- Login or register to post comments
- Read more