2

When I ping localhost the address resolves to the ipv6 loopback of ::1

My MySQL and Apache installations expects the ipv4 address of 127.0.0.1

How can I configure my WindowsXP to resolve localhost to 127.0.0.1?

My C:\WINDOWS\system32\drivers\etc\hosts file:

127.0.0.1 localhost
127.0.0.1 trunk
127.0.0.1 focus
127.0.0.1 demo

I have also have the following set in the Windows registry:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters]
"DisabledComponents"=dword:00000255

Anything else I can try?

SysAdmin1138
  • 5,449
JannieT
  • 1,231
  • 8
  • 20
  • 31

3 Answers3

1

It depends on the application that you are using i.e. your application is asking for ipv6 address.

eg. telnet on linux tries to connect using ipv6 address before it tries, unless of course you specify protocol explicitly

default

x@x:~$ telnet localhost
Trying ::1...
Trying 127.0.0.1...

v4 specified

x@x:~$ telnet -4  localhost
Trying 127.0.0.1...

For your problem since you are not binding for v6 addresses (for apache and mysql services). In mysql and apache config you can explicitly specify "127.0.0.1" in places where localhost is specified. This should solve your problem.

daya
  • 2,619
0

If you don't want to use IPv6 disable it on your connection and make sure you have IPv4 enabled.

Asuming you have a standard wired link you find this in the properties window of "local area connection". You have multiple entries there. You should see "Internet Protocol Version 6 (TCP/IPv6)" and "Internet Protocol Version 4 (TCP/IPv4)". Uncheck v6 and check v4.

Although I don't exactly understand your problem.

Tom
  • 220
0

Whether the IPv6 or IPv4 address is provided will depend on what query the software tries first. If the software tries a AAAA query first, then IPv6 will be provided.

But one way to work around this may be to adjust the definition of "localhost", which may be defined by your system's "hosts" or "hosts.txt" file. See Wikipedia Hosts file locations.

Just remove the IPv6 reference. This will probably cause the IPv6 query to provide no results, so the IPv4 query will be tried.

However, this isn't really a recommended practice; understand there may be side effects (from other programs that may rely on IPv6 and the standard "localhost" name). It is recommended to back up this file (so you can easily restore it) before mucking with changes. (A simple copy will likely do the trick.) And test any program that may use the "localhost" name before declaring your efforts to be a success.

TOOGAM
  • 16,486