ssh_config: Hostname with multiple IP addresses

Harald Dunkel harald.dunkel at aixigo.com
Mon Dec 14 23:10:00 AEDT 2020


On 12/12/20 3:50 AM, asymptosis wrote:
>> Having both IPv4 and IPv6 address defined for a specific Host would be
> 
> How would your client know which one to go to?
> 
> 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?
> 

Actually this is about providing an IPv4 and IPv6 address in parallel,
but its not uncommon to have several IP addresses in the same AF bound
to the same host name in DNS.

In this case it might be reasonable to look at the subnets of the local
network interfaces. If the ssh config file on your laptop says (for example)

	Host foo
		Hostname 192.168.1.2 10.10.0.4

and your host has a local IP address 10.10.0.5/24, its pretty obvious
which IP address ssh should connect to.

Of course I understand that this code is not in. Its just an example
to show that having multiple IP addresses on the Hostname line (or a
hostname mapping to multiple IP addresses) is not unreasonable.


Regards
Harri


More information about the openssh-unix-dev mailing list