Can you point to where it says that explicitly? I see in ssh_config(5):
HostName
Specifies the real host name to log into.
Note that "real host name" is in the singular.
It then does make use of the plural:
This can be used to specify nicknames or abbreviations for hosts
but I read that as meaning that you can configure multiple hosts, each
with its own HostName, e.g.
Host foo
HostName 192.0.2.1
Host bar
HostName 192.0.2.2
Similarly:
Arguments to HostName accept the tokens described in the TOKENS
section. Numeric IP addresses are also permitted
To me this is talking about multiple HostName entries in the same
ssh_config file, each belonging to a different Host, rather than one
HostName allowing multiple IP addresses. However I guess it could be
read either way.
It says
Hostname
Specifies the real host name to log into. This can be used to
specify nicknames or abbreviations for hosts. *Arguments to
Hostname* accept the tokens described in the TOKENS section. Nu-
meric *IP addresses* are also permitted (both on the command line
and in Hostname specifications). The default is the name given
on the command line.
Of course I understand that this is ambiguous. I don't expect any miracles
here.
Having both IPv4 and IPv6 address defined for a specific Host would be
reasonable, though.
Regards
Harri
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.
Oh, I 100% agree. I was more trying to work through what the intent in the OP could even be. It seemed to me that the proposal hadn't been carefully thought through.
In hindsight, I guess the logic could be interpreted as "try each address assigned to the Hostname in order until one succeeds".
But as you say, this would conventionally be handled just by having a separate Host per Hostname, eg
Host foo.ipv4
Hostname 192.168.0.1
Host foo.ipv6
Hostname fc00::1
I already don't like the way the client just goes through the possible private keys one at a time until the connection succeeds. IMO IdentitiesOnly should default to "yes" instead of "no".
That is, I think there should be a principle of "minimise client guessing games". So, even if multiple entries makes sense for Hostname, I would still be inclined to disagree with any proposal to add this feature.
Demonstrating that no good deed goes unpunished, this is what happens
when you allow abuse of Hostname, which is for the singular, official
*name*, with an IP address: people start expecting that it should also
handle multiple IP addresses.
This feels like a discussion about multiple addresses for private hosts
with non-public IP addresses on a local network. You can just pick one!