Insights

SSH over IPv6: How to connect and check failures

Connect over IPv6 with OpenSSH on Linux. Compare an IPv6 address with a hostname to decide whether to check DNS, the network path or login access.

Illustration of six-pin plug with one bent pin.
On this page

Secure Shell (SSH) works over Internet Protocol version 6 (IPv6). On Linux with OpenSSH, use ssh user@2001:db8::10 with your server's real IPv6 address, or use ssh -6 user@server.example.com with its hostname. Your client needs an IPv6 path to the server, and the server must accept SSH on that address and port.

In short:

  • Use the address. Enter the server's IPv6 address directly when you know it.
  • Force IPv6 by name. Add -6 to make the hostname attempt use IPv6 only.
  • Only the address works. Check name lookup and hostname-specific client settings first.

What to type for an address or a hostname

Choose the OpenSSH command for the destination and port you want to reach.

What you knowCommand below
The server's IPv6 address1: Use the address directly
The hostname to reach over IPv62: Force IPv6 by name
The IPv6 address and a confirmed nondefault port3: Specify the port

On Linux, replace user, 2001:db8::10, server.example.com and 2222 with your own values. Use these commands only for a server you're authorized to access. They don't change the server's configuration, so there's nothing to roll back.

1. Connect to the IPv6 address directly.

ssh user@2001:db8::10

2. Use IPv6 only for a hostname.

ssh -6 user@server.example.com

3. Connect on a confirmed nondefault port.

ssh -p 2222 user@2001:db8::10

Plain ssh doesn't need brackets around an IPv6 literal, which is an address written out instead of a name. Lowercase -p changes the port your client connects to, not the port the server listens on.

Which IPv6 address can you use?

Match the server's address to the network path your client can use.

Address typeWhere it works
Link-localOnly on the same local network link
Unique localOn a private network with a route to the server
Global unicastAcross IPv6 networks with an approved path to the server

Seeing an IPv6 address or a route entry doesn't prove you can reach the server or that you're allowed to connect. An IPv4-only path can't reach an IPv6-only server directly, so check for an approved path that supports IPv6.

What to check when IPv6 SSH fails

Use these read-only checks on a server you're authorized to access. They don't need a configuration rollback.

1. Compare the hostname with the expected address. On Linux with OpenSSH, use the -6 hostname form and the literal address form above. Keep the username, port and intended network path the same, and record the exact result of each attempt. Don't bypass host-key verification, which checks the server's identity, to make the tests match.

2. If the address works but the name fails, check the name and client settings first. Look up the hostname's IPv6 address in the Domain Name System (DNS) and compare it with the address that worked. An AAAA record gives you an IPv6 address, but it doesn't prove the lookup used IPv6 or that the address is reachable. If the address matches, check whether settings for that hostname change the destination, port or path before changing the server or firewall.

3. If neither attempt connects, check the route, listener and access rules. For timeouts or refusals, check the IPv6 route, whether SSH is listening on the intended address and port, and whether the rules allow your connection. A timeout means the attempt didn't finish in time, not that a firewall blocked it. A refusal means the attempt was rejected, not that nothing is listening. If the server also has IPv4, -4 is a useful comparison, but success only proves the IPv4 attempt worked.

4. If SSH rejects your login, check the account. A user authentication rejection comes after the connection reaches SSH. Check the username, credentials and account access for that attempt before changing the network.

Where doxx.net fits. The doxx.net private network can reach IPv6-enabled services while keeping IPv4 connectivity for other services. You can download the app to connect a device, but keep private SSH administration off its publicly reachable IPv6 ports.

Ask an AI assistant

Share this article

Private Everywhere

Stop giving the internet everything

Keep your browsing, messages, files, and agents private.