brian_mi Posted May 18, 2010 Share Posted May 18, 2010 Hey, does anyone could tell me the difference between ping localhost and ping 127.0.0.1? I get different results from these two commands. Link to comment Share on other sites More sharing options...
zivan56 Posted May 18, 2010 Share Posted May 18, 2010 localhost resolves to 127.0.0.1 on Windows. So you are bypassing the DNS subsystem when you ping the IP directly. It may be different on Windows 7, where localhost resolves to an IPv6 address by default. Link to comment Share on other sites More sharing options...
gdodson Posted May 18, 2010 Share Posted May 18, 2010 If pinging localhost gives you replies from ::1, that's your IPv6 address where 127.0.0.1 is an IPv4 address. Link to comment Share on other sites More sharing options...
brian_mi Posted May 18, 2010 Author Share Posted May 18, 2010 Yes I'm trying on Win7 and i get ::1. my further question is, why to resolve localhost to ipv6? what if i have Apache on my machine? it goes under ipv6? Link to comment Share on other sites More sharing options...
+BudMan MVC Posted May 18, 2010 MVC Share Posted May 18, 2010 If your not using IPv6 -- you can just disable it. reg add hklm\system\currentcontrolset\services\tcpip6\parameters /v DisabledComponents /t REG_DWORD /d 255 As you see my win 7 box does not resolve localhost to the ipv6 address Microsoft Windows [Version 6.1.7600] Copyright © 2009 Microsoft Corporation. All rights reserved. C:\Windows\System32>ping localhost Pinging quad-w7.local.lan [127.0.0.1] with 32 bytes of data: Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Link to comment Share on other sites More sharing options...
brian_mi Posted May 19, 2010 Author Share Posted May 19, 2010 If your not using IPv6 -- you can just disable it. reg add hklm\system\currentcontrolset\services\tcpip6\parameters /v DisabledComponents /t REG_DWORD /d 255 As you see my win 7 box does not resolve localhost to the ipv6 address Microsoft Windows [Version 6.1.7600] Copyright © 2009 Microsoft Corporation. All rights reserved. C:\Windows\System32>ping localhost Pinging quad-w7.local.lan [127.0.0.1] with 32 bytes of data: Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 Thanks BudMan~~ :shifty: Link to comment Share on other sites More sharing options...
Fred Derf Veteran Posted May 19, 2010 Veteran Share Posted May 19, 2010 Presumably this was done with the expectation that by the end of Windows 7s life cycle that IPv6 addresses will be the norm or even required. Link to comment Share on other sites More sharing options...
The_Decryptor Veteran Posted May 19, 2010 Veteran Share Posted May 19, 2010 It's just the right thing to do if you have IPv6 enabled, it should try v6 first and fallback to v4 if it isn't possible. Edit: It's so stuff like this works fine. If you have v6 connectivity you should get the v6 address over the v4 one. Link to comment Share on other sites More sharing options...
Recommended Posts