How to SSH to an IPv6 address

SSH to an IPv6 address is very easy once you know how to do it. Follow this article to find the solution why you currently can’t SSH to your system that has an IPv6 address.

IPv4 did come with the internet. It addresses every device a unique number so we can identify and connect with hem. Nobody thought we would run out of IPv4 addresses. There are more than 4 billion possible IP addresses to hand out. But in this era, with every device connected to the internet, we need more IP addresses. That is why IPv6 will replace IPv4.

An implementation of a new protocol can have some problems. We noticed some people have trouble SSH’ing to their systems with IPv6. They are not used to the long addresses and don’t know how to connect to them.

If your IPv6 address starts with fe80 you follow the first part of this article. Follow the second part of the article if your address does not start with fe80.

IPv6 starts with fe80

If the IPv6 address you want to connect to starts with fe80::, we are talking about a link-local address. Access to this address is only possible within the same network or domain. Every device has a link-local address. Either assigned by an administrator or automatic. To get all the details of the network interfaces, you can use ifconfig.

By doing this, you are trying to find any of the following identifiers: eth0, wlan0, enp3s0, wlp4s0 or tap1. In this post, we would consider the identifier eth0.

To connect to the IPv6 address you use the following command:

ssh <username>@<ipv6 address>%<interface>

And a specific example of this would be:

ssh user@fe80::21b:21ff:fe22:e865%eth0

In this example, we have replaced <interface> with the actual interface. If you are not sure which interface to use, you can try them all out. The <ipv6 adress> part did we replace with the actual IPv6 address. Fill in the username you want to use for the connection at the <user> part.

IPv6 Address does not start with fe80

If your IPv6 does not start with “fe80”, then you can enter the following command to connect to an IPv6 address.

ssh <username>@<ipv6 address>

And a specific example of this would be:

ssh uli@2a01:4f9:c010:278::1

We have replaced the <ipv6 adress> with the actual IP address. In the <username> placeholder we can fill in the username we want to use.