Following are the entries in my /etc/hosts.

I was wondering what is the last entry (fe80::1%lo0 localhost) for. localhost broadcasthost
::1 localhost
fe80::1%lo0 localhost
  • 3
    The %lo0 is an IPv6 zone identifier, most systems do not support this in name services.
    – Steve-o
    Dec 14 '10 at 3:58
  • 3
    What applications would use this information? In other words, if one were to edit that line out, what would it break?
    – user79418
    May 2 '11 at 20:08

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

  • 4
    I should also mention that the "%lo0" part is necessary because any link-local address would be ambiguous if it weren't explicitly tied to an interface.
    – eater
    Dec 14 '10 at 13:27
  • 1
    There is no NDP on loopback interfase and ::1 used as IPv6 equivavelent of, not fe80::1%lo0.
    – citrin
    Mar 2 '18 at 19:38
  • What if my actual loopback interface name is (as reported by ifconfig) simply lo and not lo0? Also why include 2 IPv6 hosts records for localhost?
    – Ivan
    Feb 19 '19 at 18:45

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.

 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.

  • Misleading - it's fe80/10, i.e. not a "fe80:" prefix. There are 64 prefixes. Nov 20 '17 at 23:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy