In situations where IPv6 connectivity performs better than IPv4, you might want to force SSH to use IPv6. In interactive mode this can be achieved with the -6 commandline parameter. But in situations where you can't modify the commandline parameters a different approach is needed (for example in rsync backup scripts which use SSH as underlying transport layer).
We can use the ssh_config file to encforce that IPv6 is used for a specific host:
This instructs all SSH commands to use IPv6 when connecting to myipv6host.
The same approach also works to force usage of Legacy IP by specyfing inet as address family.