cmd

Ping returns IPv6 Address, ping IPv4?


If you are on the same network, or VLAN, or subnet as someone else – you will probably notice that if you ping their hostname it will return with a IPv6 address.

Ping srv01
Pinging srv01.contoso.com [fe80::c09::d4e6::189f::f661%3] with 32 bytes of data
Reply from fe80::c09::d4e6:189f:f661%3: time<1ms
Reply from fe80::c09::d4e6:189f:f661%3: time<1ms

ping ipv4

The fact is that the IPv6 protocol in Windows Vista and above is the preferred protocol over IPv4.

If you want to still see what’s their IPv4 address, then simply use the command below:

ping hostname -4

Simply add a flag “-4” after your normal ping command:

Ping srv01 -4
Pinging srv01.contoso.com [192.168.10.21] with 32 bytes of data
Reply from 192.168.10.21: bytes=32 time<1ms TTL=128
Reply from 192.168.10.21: bytes=32 time<1ms TTL=128

ping ipv4 cmd

As you can see, ping command returned standard IPv4 address.

In the event that, when the client requests the server and it returns the IPv6 address, and there are some problems with the operation of some legacy applications, there is a more advanced solution.

The solution is to increase the priority of the IPv4 over the IPv6 protocol, but with the continued operation of IPv6.

The solution doesn’t require reboot, it takes effect immediately. You need to open an elevated Command Prompt, and execute 2 commands:

netsh interface ipv6 set prefix ::/96 60 3
netsh interface ipv6 set prefix ::ffff:0:0/96 55 4

On an example of a clean Windows Server 2016, execute these two commands and check ping again:

Pinging srv01.contoso.com [192.168.10.21] with 32 bytes of data
Reply from 192.168.10.21: bytes=32 time<1ms TTL=128
Reply from 192.168.10.21: bytes=32 time<1ms TTL=128

ping return ipv4

As you can see, the result changed dramatically in the direction we needed, the IPv4 address 192.168.10.21 began to return. Now we’ll check that the server is still pinging using its IPv6 address, and we didn’t break anything:

ping fe80::c09::d4e6:189f:f661%3

ping ipv4 command line

Everything works as it should be.

READ ALSO  Move Windows 10 apps to USB thumb drive or SD card and change default app save location

You can also change preferred IP protocol from GUI. To do it, open Control Panel -> Network and Internet -> Network Connections -> Advanced -> Advanced Settings.

Tip. Adapters and Bindings dialog box is missing in a newest Windows 10/Windows Server 2016.

how to ping ipv4

Select your network connection and using green button set the IPv4 protocol above IPv6. You should perform this operation for all available bindings.

ping returns ipv6


You may also like:

Sysprep a Windows 7 Machine – Start to Finis... This is the old version, please see the new Sysprep a Windows 7 Machine – Start to Finish V2. Note - I highly recommend creating a boot or rescue d...
Sysprep a Windows 7 Machine – Start to Finish V2 This is version 2 of a step by step guide on Sysprepping a Windows 7 machine from start to finish. I cannot take full credit on this because my first ...
Install Windows 7 VGA driver on Dell GX270 This is a short guide on solving the problem when trying to install the VGA driver on a Dell GX270 when Windows 7 is installed. GX270 VGA Driver Inst...
DISM Tool – WinPE 3.1 Boot Environment This is the new tutorial for the recent release of WinPE 3.1. You can still read the old tutorial here. DISM Tool You will need the following to...
Copy Taskbar Icons Windows 7 Sysprep This is the old version, please see the new Copy Taskbar Icons Windows 7 Sysprep v2. Ok, you can thank a colleague of mine (Dinyero Johnson) for th...
  • the brain

    is there a way to change it so that it responds on IPv4, by default? I don’t want to disable IPv6, but do not want to use it at all
    Thanks!

    • Brian Jackson

      If you are not using IPv6 there is no reason to have it enabled. To disable it, go to Network Connections, right click Properties on your NIC and then uncheck “Internet Protocol Version 6 (TCP/IPv6).
      Hope that helps! There is no way unfortunately to default to IPv4 like in command prompt.

      • Ronny Ong

        Unchecking the protocol binding is not sufficient to disable IPv6. It will seem to work at first, but you will eventually run into strange network problems that seem to defy any explanation. This is ESPECIALLY true for servers. To properly disable IPv6, see KB929852. The “Fix It” MSI available from this KB article is suitable for GPO deployment, no need to create a custom ADMX.

      • AM

        That does not disable IPv6 totally. You can do the following to disable it totally: Create a DWORD entry named DisabledComponents in HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpip6Parameters and give it the value 0xffffffff

        Abdeslam Mazouz
        Network Security
        Minnesota

  • Rod

    thanks,

  • Pascal

    hell yeah…

    Thank you dude! Helped me very much right now!!
    Till now i had to disable ipv6, reboot and at least but not last change the computername (in a automated tailoring of my system). Now i can rename after disabling, without a reboot!

    Thank you (again)

    greez