title: How to handle ssh host key verification with 2 different hosts on the same (but changing) IP address?
body: <p>I have 2 ssh servers behind a nat firewall at a location that changes its wan IP every day. They are always at the same wan IP address on a given time but on different ports.</p>
  
  <p>I am connecting to server A this way:</p>
  
  <pre><code>ssh -p 22001 karl@x1.example.com
  </code></pre>
  
  <p>and to server B:</p>
  
  <pre><code>ssh -p 22002 karl@x2.example.com
  </code></pre>
  
  <p>So I get 2 different host keys for the same IP, and also when the IP changes even a different IP for the same host.</p>
  
  <p>I have to go on deleting over and over the other key or the old key (in case of IP change) in the known_hosts file. </p>
  
  <p>I am hesitating to turn the key verification off, because this would be less secure. But getting a warning all the time is also unsecure (because I ignore such warnings all the time then). Is there a better solution?</p>
  
  <p>This is related to my old question here but not the same:</p>
  
  <p><a href="https://stackoverflow.com/questions/696793/ssh-login-warning-message-on-a-server-with-2-dns-names">SSH login warning message on a server with 2 DNS names</a></p>