Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Following are the entries in my /etc/hosts.

I was wondering what is the last entry (fe80::1%lo0 localhost) for.

127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
share|improve this question

migrated from stackoverflow.com Feb 4 '11 at 12:23

This question came from our site for professional and enthusiast programmers.

1  
The %lo0 is an IPv6 zone identifier, most systems do not support this in name services. –  Steve-o Dec 14 '10 at 3:58
    
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
add comment

3 Answers

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.

share|improve this answer
2  
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
add comment
 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.

share|improve this answer
add comment

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 routeable 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, routeable address when they later find out from their router or server where they are supposed to be on the internet.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.