Sometimes when using ‘ping’ command to ping a host, computer or server on the same network, VLAN or subnet with its hostname or FQDN domain name, it will return the IPv6 address of the host, instead of commonly used IPv4 IP address.

For example,

> ping hostname

Pinging hostname [fe80::4016:fe2b:ba1e:ffd2%10] with 32 bytes of data:
Reply from fe80::8016:fe2b:ba1e:ffd2%10: time=2ms
Reply from fe80::8016:fe2b:ba1e:ffd2%10: time=5ms
Reply from fe80::8016:fe2b:ba1e:ffd2%10: time=1ms
Reply from fe80::8016:fe2b:ba1e:ffd2%10: time=3ms

Ping statistics for fe80::8016:fe2b:ba1e:ffd2%10:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 1ms, Maximum = 5ms, Average = 3ms

The reason for IPv6 IP address to be returned by ping command is that Windows operating system has set IPv6 protocl as the preferred protocol that takes precedence over IPv4 in Windows Vista and newer OSes.

You can still force ping to return IPv4 address though, which is much easier to remember and work with, by using the following command:

ping hostname -4

The “-4” switch forces ping command use IPv4 address. And the result will be similar to the following:

> ping hostname -4

Pinging hostname [192.168.1.1] with 32 bytes of data:
Reply from 192.168.1.1: bytes=32 time=2ms TTL=128
Reply from 192.168.1.1: bytes=32 time=4ms TTL=128
Reply from 192.168.1.1: bytes=32 time=2ms TTL=128
Reply from 192.168.1.1: bytes=32 time=3ms TTL=128

Ping statistics for 192.168.1.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 2ms, Maximum = 4ms, Average = 2ms