PDA

View Full Version : Format of the /etc/hosts file


pobbz
2007-05-29, 09:50 AM CDT
Hello.

I just noticed that my /etc/hosts file contains a line beginning with "::1" (w/o quotes). After that the line contains my host's name and "localhost". I wonder what's that line for? 'man hosts' says nothing about it.

Also, the manpage for nslookup shows the following synopsis for the nslookup command:

nslookup [-option] [name | -] [server]

However, it doesn't say a word about the options. What might they be?

Thanks.

Ric-O-Matic
2007-05-29, 09:58 AM CDT
It's the loopback address for IPV6 (same as 127.0.0.1 for IPV4).

pobbz
2007-05-29, 10:24 AM CDT
It's the loopback address for IPV6 (same as 127.0.0.1 for IPV4).

Ok, thanks.

Would you suggest adding a similar line for IPv4 routing to my hosts file, because currently there's no line saying anything about 127.0.0.1, this happens:
[root@athlonxp mail]# traceroute -4 localhost
localhost: Name or service not known
Cannot handle "host" cmdline arg `localhost' on position 1 (argc 2)

As you said the line with "::1" indeed seems to be for IPv6, because this works:

[root@athlonxp mail]# traceroute -6 localhost
traceroute to localhost (::1), 30 hops max, 40 byte packets
1 athlonxp.ring-0 (::1) 0.100 ms 0.018 ms 0.015 ms


So, does it break anything if I add a line with 127.0.0.1 to /etc/hosts?