nat

Accessing ssh servers behind NAT

Create 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

Syndicate content
Comment