Force SSH over IPv4 or IPv6

Vint Cerf IPv6 poster

I’ve got an IPv6 connection at home via Sixxs which works pretty well.

Of course some of the time when I need to access certain machines from outside the office I’ll run into issues ie. I can get in over IPv4, but not over IPv6.

Other times the IPv6 connection from wherever I happen to be might not be as stable as the IPv4 one.

So being able to force an SSH connection over IPv4 (or over IPv6) is handy (and this is more for my own reference than anyone else’s!):

ssh -4 user@hostname

Will force the connection over IPv4, while:

ssh -6 user@hostname

will force it over IPv6.

Obviously you will need to be on an IPv6 enabled connection in order to SSH over IPv6.

By Michele Neylon

Michele is founder and CEO of Irish hosting provider and domain name registrar Blacknight.

One comment

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Exit mobile version