1

I have an entry like this in /etc/hosts: fe80::XXXX:XXff:feXX:XXXX%enp0s25 test-ipv6 This is a link-local address. I've masked out my MAC address (with the 7th most significant bit flipped) for this post.

I can ping the address, but pinging test-ipv6 gives ping: test-ipv6: Name or service not known. Why doesn't it work? Is there a different way to assign an IPv6 link-local address to a hostname?

I'm using Arch Linux with kernel version 4.17.2.

EDIT: this is mostly a duplicate of IPv6 Zone ID in /etc/hosts.

  • you probably instead want to use a not link-local address as whatever reads hosts doubtless does not know about what interface the address is supposed to be on – thrig Jun 28 '18 at 22:31
  • @thrig Yes, with a link-local address you always have to specify the interface (in my example this is %enp0s25). – Manuel Jacob Jun 28 '18 at 22:33
  • Related question: unix.stackexchange.com/questions/174767/…. TL;DR: It's not supported by the lookup routines, and seems to be a long-standing issue. My guess is that ping special-cases literal link-local addresses. – ErikF Jun 29 '18 at 1:18
  • @ErikF That question is basically asking for the same thing as my question (although I'll leave my question to make it easier to find for people with my problem). Note that the special case for link-local addresses is in Linux' network stack, as ping shouldn't even try to resolve them if someone gives IP addresses to ping (independent of whether they are link-local or not). – Manuel Jacob Jun 29 '18 at 3:23
0

Use Link-local Multicast Name Resolution (LLMNR) or Multicast DNS (mDNS) (implemented by systemd-resolved) on your network. With LLMNR or mDNS, the hosts on the local network respond with their own hostnames. On a modern Linux distribution, the scope id for a link-local IPv6 address is returned by the resolver and everything should work even when using link-local IPv6 addresses.

Depending on your Linux distribution, you may already have LLMNR enabled: try

ping -6 somehost

(or ping6) where somehost is the host on the same LAN you are trying to reach.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.