1

A project (Linux based) I am working on requires an IPv6 only network interface which can be accessable via mDNS when connected to a network or when directly connected to another machine. The interface provides some web services and can be used for ssh as well. I have ran into issues when directly connecting with another machine where I cannot connect using the host name provided by Avahi.

I have done some research and it appears the issue is due to the interface only establishing a link local address. I can ssh into the unit by specifying the IPv6 address and interface as address%interface.

My question is, how can I configure an IPv6 interface to auto configure when connected to a router and establish a non link local address when directly connected, or is there a preferred method to support an Avahi IPv6 network that requires no configuration and supports network or direct connection?

1 Answer 1

1

Specifying link-local addresses as address%interface is normal and expected in IPv6. That's how link-local IPv6 addresses are supposed to work.

The normal method for IPv6 would be to configure the router to send out IPv6 router advertisements, that include the information on the network address and prefix to be used, and the address autoconfiguration methods to use (DHCPv6 and/or SLAAC).

If the non-link-local prefix is /64 or wider, and the information in the router advertisement permits the use of SLAAC, the client can just pick the host address part automatically (either based to the MAC address of the NIC as per EUI-64/RFC 4291, a stable privacy address according to RFC 3972 and 7217, or a temporary address according to RFC 4941).

If you need a non-link-local address on a direct connection, you should probably use ULA addresses (i.e. addresses within range fc00::/7). They are the IPv6 equivalent of RFC 1918 addresses. In IPv6, it is normal and expected for an interface to have multiple IPv6 addresses assigned to it, so you could just let the autodetection work as usual and configure your system to always add a ULA address to the network interface for direct connections as an addition to whatever addresses may be auto-detected.

3
  • My experience with IPv6 link-local addresses and mDNS (and LLNMR, which is Microsoft's similar mechanism) is that they work perfectly well together. I'm using systemd-resolved as the mDNS responder. The interface is conveyed in the response. IPv6 link-local addresses are more useful than people think they are. Commented May 14, 2020 at 10:32
  • Ok the ULA approach looks like it works, as I can then ssh if I use the IPv6 address directly with ssh. I get the correct ULA from avahi-resolve-host-name as well. The issue is that I still cannot use the hostname directly with ssh, curl, or the browser. It's odd because this all worked with IPv4 and avahi. Any ideas on why I can't resolve the IPv6 address by hostname using anything but avahi-resolve-host-name? Commented May 14, 2020 at 20:23
  • Does your /etc/nsswitch.conf include mdns6 or mdns on the hosts: line, or just mdns6_minimal or mdns_minimal? The latter two will only resolve link-local addresses. Using the non-minimal versions can cause an extra 5-second wait in hostname resolution for non-local non-existent hostnames, which can be annoying in some situations, for example if your shell does hostname completion for ssh/scp/sftp commands. If your hosts: line only includes mdns4_minimal, that's why mDNS works only with IPv4. Change it to mdns6_minimal if using IPv6 only, or mdns_minimal if using both. Commented May 14, 2020 at 21:37

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.