1

I am no expert in DNS or IPv6. I am using a brand new Mac with what seems to be the default:

127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost

I have enabled Apache. With the above hosts file, localhost is not working in the browser. From what I have read I think it's ipv6 that I haven't configured Apache for.

What I tried:

127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             127.0.0.1

Everything works fine now. My question is, is mapping "::1" to "127.0.0.1" ok? Am I breaking/losing something in DNS by doing this. If so, I am not clear how to edit my conf file to allow apache to answer to localhost.

  • No, you should be having Apache listen on ::1 or :: . – Michael Hampton Oct 3 '16 at 17:48
  • @MichaelHampton This is the conflicting information I am finding. Some people say to just delete the line from hosts, but this seems more like i have pushed the problem to somewhere else. Some say fix apache, but I haven't found the conf file changes that need to be made. The conf changes along with an explanation of Apache with ipv6 would be beneficial, no matter how brief or simple it may seem to some. I am starting from the beginning with server configuration. Can apache listen to both 127 and ::1 ? – Radio Oct 3 '16 at 19:25
  • Basically you should discount anyone who advises you to disable, ignore, or otherwise not work with IPv6. It's mandatory these days, after all. Apache will perfectly well handle more than one Listen directive. – Michael Hampton Oct 3 '16 at 19:28
  • @MichaelHampton and there it is: httpd.apache.org/docs/2.4/bind.html Thank you kindly for the direction. – Radio Oct 3 '16 at 19:38
4

You're not actually mapping ::1 to 127.0.0.1 in this case. You're providing an invalid name for ::1 that is essentially disabling the entry. You can't map an ipv6 address to an ipv4 address - they're not compatible.

If you need localhost resolution for ipv6 to not be enabled, simply comment the ::1 line out, or don't include it at all.

  • Thank you. Do you have a recommended resource to learn what the "::1" address syntax even means and how to learn more about ipv6? – Radio Oct 3 '16 at 16:17
  • 1
    @Radio ::1 is the same as 127.0.0.1 IPv6 Tutorial – klanomath Oct 3 '16 at 16:46
  • 3
    ::1 is the loopback interface as addressed by IPv6. The hosts file syntax is simply: "<address> <Short hostname> <fully qualified name>". All fields are space separated, and only one entry may exist per line. The hosts file will not map addresses to addresses, but will map addresses to names. – Spooler Oct 3 '16 at 16:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .