SSH known_hosts for cluster environments

Something I always forget where it’s written in (sshd(8)), but which is pretty useful when you have a cluster setup where heartbeat manages failover and stuff. And you want to use ssh to connect to the cluster.

Whenever heartbeat switches the cluster-ip to the second machine and you try to ssh to it, ssh will reply with a nice WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! - which isn’t helpful.

But SSH knows how to deal with it, the user just needs to tell it about that. Imagine you have the two machines foo1 AKA 192.168.1.1 and foo2 AKA 192.168.1.2 and the clustername foo AKA 192.168.1.10. Adding the following to your .ssh/known_hosts will keep your ssh happy if you ssh foo, no matter on which machine the cluster-ip is: