Linux link local ipv6

A link-local address is an Internet Protocol (IP) unicast address intended to be used only to connect to the hosts on the same network, or link (such as an Ethernet one) as the given host. The activities below are intended to show how to view and test IP link-local addresses in Linux-based systems.

Contents

Readings [ edit | edit source ]

Preparation [ edit | edit source ]

To prepare for this activity:

Conventions [ edit | edit source ]

The commands available to non-privileged users are from now on written as $ command (where $ is the shell prompt, and is not to be typed.)

The commands available only to the privileged users are written as # command (where # is again not to be typed.) Depending on the configuration, you may be able to execute them either of the following ways:

  • by using $ sudo command (and entering your own user password);
  • by using $ su -c ‘command’ (and entering the “root” password);
  • by logging in as root , or switching there with either $ sudo -i or $ su , and entering the command directly into the resulting privileged shell;
  • not at all, if you are not authorized to perform administrative tasks on the host in question.

Activities [ edit | edit source ]

Check currently assigned addresses [ edit | edit source ]

  1. Use $ ip address list (or simply $ ip a ) to view all the addresses currently assigned to the system’s interfaces.
  2. The output is expected to contain a section for the local loopback interface (named lo ), and a section for an Ethernet network interface controllers (henceforth assumed to be named eth0 .)
  3. Examine this latter section to find entries for link-local, globally-routable IPv6, and all the IPv4 addresses, and compare them to the following examples. inet6 fe80::349d:33ff:fe76:2cee/64 scope link This is a IPv6 link-local address, as indicated by:
    • its fe80::/64 network prefix;
    • the explicit scope link flag.

    inet 169.254.46.5/16 brd 169.254.255.255 scope global eth0 A link-local IPv4 address, as indicated by its 169.254.0.0/16 prefix. inet6 2001:db8:42::349d:33ff:fe76:2cee/64 scope global A globally-routable IPv6 address, as indicated by the explicit scope global flag. inet 192.0.2.34/24 brd 192.0.2.255 scope global eth0 A non-link-local IPv4 address, which may have been assigned either manually, or via DHCP.

  4. Note that while link-local addresses are essential for IPv6 operation (and thus are expected to be found whenever IPv6 is configured on the host), IPv4 link-local addresses are generally only found when no other addresses are available for an interface.

Test connectivity [ edit | edit source ]

  1. If a globally-routable IPv6 address was found to be available at the previous step, test IPv6 connectivity with $ ping6 -c 3 2001:4860:4860::8888 .
  2. If a non-link-local IPv4 address was found to be available, test IPv4 connectivity with $ ping -c 3 8.8.8.8 .
  3. Either or both pings are expected to report 0% packet loss.
  1. Note that link-local addresses are essential for IPv6 operation, and thus are expected to be already available, provided that IPv6 networking is configured on the host.
  2. Check if the IPv4 link-local address daemon is already started for the interface with $ ps -o pid,cmd -C avahi-autoipd .
    1. If yes, you may wish to stop one and start it anew. In order to do that:
      1. record the exact command used to start it (as shown by the previous ps command), so to be able to restart it afterwards;
      2. stop it with # avahi-autoipd —kill eth0 and start again with the command below.
      1. Test link-local connectivity by pinging another host on the same network with the following commands.
      2. Note that you need to find out that host’s exact link-local addresses beforehand; the addresses shown below are examples and are unlikely to work on any given network.
      3. If IPv6 is available, use $ ping6 -c 3 fe80::7c9a:12ff:fe82:18e6 .
      4. Use $ ping -c 3 169.254.116.12 .
      5. Either or both pings are expected to report 0% packet loss.

      Reverting the run-time configuration changes [ edit | edit source ]

      1. If the IPv4 link-local address daemon was previously started, you may need to revert the changes thus made to the run-time configuration. Skip this section otherwise.
      2. Stop the currently running daemon with # avahi-autoipd —kill eth0 .
      3. If the daemon was previously stopped, use the command line recorded to start it again.
      1. Test link-local connectivity, or absence thereof, by pinging another host on the same network with the following commands.
      2. Note that you need to find out that host’s exact link-local addresses beforehand; the addresses shown below are examples and are unlikely to work on any given network.
      3. If IPv6 is available, use $ ping6 -c 3 fe80::7c9a:12ff:fe82:18e6 . It’s expected to report 0% packet loss.
      4. Use $ ping -c 3 169.254.116.12 . It’s expected to report either 100% packet loss if no IPv4 link-local address daemon is currently running, or 0% packet loss otherwise.

      See also [ edit | edit source ]

      Источник

      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 Yes, with a link-local address you always have to specify the interface (in my example this is %enp0s25 ).

      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 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).

      1 Answer 1

      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

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

      You must log in to answer this question.

      Linked

      Hot Network Questions

      Subscribe to RSS

      To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

      Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.7.14.43533

      Linux is a registered trademark of Linus Torvalds. UNIX is a registered trademark of The Open Group.
      This site is not affiliated with Linus Torvalds or The Open Group in any way.

      By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

      Источник

      Читайте также:  Ps2 linux kernel loader
Оцените статью
Adblock
detector