How can I add an IPv6 address with a scope ID to the ssh config file?
You need to double the percent sign, like this:
Host vmiab
HostName fe80::1%%usb0
ssh-config has various substitutions such as %h
and %l
, and if you want a literal percent sign it has to be escaped as %%
.
Beside the escaping of the percent sign, it can be necessary to enclose an ipv6 address into brackets []
.
It's necessary when the hostname is used by a ProxyCommand.
Host vmiab
HostName [fe80::1%%usb]
ProxyCommand ssh my_proxy_host -W %h:%p
Or you could enclose the host [%h]
in the ProxyCommand (prefered solution)
Host vmiab
HostName fe80::1%%usb
ProxyCommand ssh my_proxy_host -W [%h]:%p
It's better to use the brackets in the ProxyCommand, because using brackets in the hostname only works with ProxyCommand, but fails without.