8

I have a Windows 7 64 Bit machine, and I cannot find a way to disable the IPv6 Loopback. I looked at the article at How to disable IP version 6 or its specific components in Windows and shows how to set HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\DisabledComponents to various values – but none of these seems to disable IPv6 Loopback. I attempted setting this value to 0xffffffff and 0x20 – restarting my computer after each change, and I still do not get this disabled.

I am using another software called Webdriver or Selenium that gives errors when debugging if IPv6 Loopback is not disabled. It seems to attempt to connect to [::1]:7055 and fails. Is there a way to force it to connect to 127.0.0.1.

1

3 Answers 3

19

I would instead modify the prefix policies so IP4 addresses are used over IPv6 when available.

C:\>netsh interface ipv6 show prefixpolicies
Querying active state...

Precedence  Label  Prefix
----------  -----  --------------------------------
        50      0  ::1/128
        40      1  ::/0
        30      2  2002::/16
        20      3  ::/96
        10      4  ::ffff:0:0/96
         5      5  2001::/32

In the list above the lines with labels 3 and 4 represent IP4 compatibility listings. If you increase their precedence they will be preferred. They need to be higher than the one with label 0 as that is the localhost address.

C:\>netsh interface ipv6 set prefix ::/96 60 3
Ok.

C:\>netsh interface ipv6 set prefix ::ffff:0:0/96 55 4
Ok.

Now if you ping localhost or the hostname it will use the IP4 address over an IPv6 address when both are available. In fact for everything with an IP4 address it will use that over an IPv6 address.

0

Try editing your hosts file (C:\Windows\System32\drivers\etc\hosts). My hosts file looked like this when I first opened it:

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost

Uncomment the IPv4 loopback address associated with localhost, and make sure the line beginning with ::1 is commented out.

# localhost name resolution is handled within DNS itself.
  127.0.0.1       localhost
# ::1             localhost

Two more things to keep in mind:

  1. You'll need to start your text editor (Notepad for instance) with elevated privileges or you won't be able to save the file when you're finished editing. When starting the editor, simply right click and choose 'Run As Administrator'.

  2. When you're finished editing, save your changes to the hosts file and reboot your machine.

Side note: on some systems an operator can ask the DNS server to re-read it's config file by sending SIGHUP (Example: kill -HUP <pid>). I imagine there is a way to do something similar in Windows 7 (thus avoiding reboot).

1
  • 3
    Thanks @Double. My hosts file actually does this i.e. 127.0.0.1 uncommented, and ::1 commented out. A ping localhost does connect to 127.0.0.1. However, I wanted to know of a way to disable the IPv6 loopback completely - so that software running on my machine does not know about the IPv6 loopback
    – O.O.
    Mar 4, 2013 at 22:13
0

uncheck ipv6 protocol under your lan adapter. combined with the registry edit you have, there will be no ipv6 on your system at all.

You must log in to answer this question.

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