ssh_config: Hostname with multiple IP addresses

David Newall openssh at davidnewall.com
Tue Dec 15 10:29:06 AEDT 2020


> Say I had:
>
> Host foo
> Hostname 192.168.2.2 192.168.2.3
>
> Do I end up at 192.168.2.2 randomly half the time, and 192.168.2.3 the 
> rest of the time?

I find the man page unambiguous: HostName specifies the singular real 
host name to log into.  Alternatively, a singular IP address is permitted.

I can see how "Numeric IP addresses are also permitted" could be 
construed as meaning multiple addresses on the one line, but, that's an 
incorrect reading.  It really means, IP addresses can be used in 
HostName entries.

All of this fails to help the original question, which is how to specify 
multiple IP addresses.  The obvious answer to that is to put multiple A 
records into your local DNS.  If you don't have a local DNS or have no 
control over it, specify multiple Hosts in your config, one for each IP 
address.



More information about the openssh-unix-dev mailing list