What is the relevance of "fe80::1%lo0 localhost" in /etc/hosts?

Solution 1:

It's an IPv6 address. The fe80:: block is reserved for link-local addresses. Link local addresses are used for packets sent only to directly connected devices (not routed). The network discovery protocol (NDP) is the biggest user of link-local addresses (NDP sorta replaces ARP and DHCP in IPv6).

Each of your interfaces will have a different link-local address starting with fe80:: and (typically) ending with a modified version the interface's MAC address (EUI-64 format) to ensure you have a unique address on your segment. In the case of your loopback interface, there isn't anything else connected to it, so it can use the address of fe80::1 without fear of conflict, which is why fe80::1 is typically used as the "localhost" address--the IPv6 equivalent of 127.0.0.1.

Solution 2:

Excellent answer above from eater. IPv6 link-local addresses, as said above, of the form fe80:* in fact fe80::/10 meaning the top ten bits only are matched against fe8*:* so the range is fe80::0 .. febf:*. Check my arithmetic.

These addresses are the equivalent of 169.254.\*.\* addresses in IPv4, although the IPv4 counterparts are much much less well used.

It is very common to have several addresses in ipv6 but only one in IPv4. Having both an fe80:: adress and a globally meaningful routable IPv6 address (such as 2001:* for example) is the rule not the exception. Unfortunately applications and operating systems don't tend to do the same in IPv4, that is, interfaces tend not to have several IPv4 addresses, and I haven't seen the case where an interface has say a 169.254.\*.\* address and another type of address simultaneously.

Simultaneously using the two types in IPv4 would prevent a lot of pain and suffering when for example kit powers up in the wrong order, pcs power up before routers or servers and the PCs assign themselves a 169.254.\*.\* address and stick with only that rather than adding a second globally meaningful, routable address when they later find out from their router or server where they are supposed to be on the internet.

Solution 3:

 fe80::.....        a link local address

Link-local IPv6 addresses, indicated by the fe80: prefix, are only valid on the immediate network link to which that host interface is connected.

  • http://www.ipv6.leeds.ac.uk/Docs/ipv6_linux_tips.txt
  • http://www.snmp.com/protocol/ipv6.shtml