Link-local address/Linux

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.

Readings

 * Link-local address at Wikipedia.
 * Manual pages:
 * ip-address(8);
 * ping6(8) (also covers the  command);
 * avahi-autoipd(8).

Preparation
To prepare for this activity:
 * 1) ensure that the Linux-based system of choice is started;
 * 2) log into the system.

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

The commands available only to the privileged users are written as  (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  (and entering your own user password);
 * by using  (and entering the “root” password);
 * by logging in as, or switching there with either   or  , 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.

Check currently assigned addresses

 * 1) Use   (or simply  ) 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  ), and a section for an Ethernet network interface controllers (henceforth assumed to be named  .)
 * 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.
 * This is a IPv6 link-local address, as indicated by:
 * its  network prefix;
 * the explicit  flag.
 * A link-local IPv4 address, as indicated by its  prefix.
 * A globally-routable IPv6 address, as indicated by the explicit  flag.
 * A non-link-local IPv4 address, which may have been assigned either manually, or via DHCP.
 * 1) 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.
 * A globally-routable IPv6 address, as indicated by the explicit  flag.
 * A non-link-local IPv4 address, which may have been assigned either manually, or via DHCP.
 * 1) 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.
 * 1) 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

 * 1) If a globally-routable IPv6 address was found to be available at the previous step, test IPv6 connectivity with.
 * 2) If a non-link-local IPv4 address was found to be available, test IPv4 connectivity with.
 * 3) Either or both pings are expected to report 0% packet loss.

Obtain an IPv4 link-local address

 * 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.
 * 3) If yes, you may wish to stop one and start it anew.  In order to do that:
 * 4) record the exact command used to start it (as shown by the previous   command), so to be able to restart it afterwards;
 * 5) stop it with   and start again with the command below.
 * 6) If no, start the daemon with.
 * 7) Check the   output to ensure that an IPv4 address in the   range is indeed assigned to.

Test link-local connectivity

 * 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.
 * 4) Use.
 * 5) Either or both pings are expected to report 0% packet loss.

Reverting the run-time configuration changes

 * 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.
 * 3) If the daemon was previously stopped, use the command line recorded to start it again.

Test link-local connectivity

 * 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  .  It’s expected to report 0% packet loss.
 * 4) Use  .  It’s expected to report either 100% packet loss if no IPv4 link-local address daemon is currently running, or 0% packet loss otherwise.