Why ping localhost from root IPv6 selected?

Linux zika.gattaca.net 5.8.0-48-generic #54-Ubuntu SMP Fri Mar 19 14:25:20 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

I just noticed that only when I ping from the root IPv6 is selected:

root@#########:/etc/samba# ping localhost

PING localhost(localhost (::1)) 56 data bytes
64 bytes from localhost (::1): icmp_seq=1 ttl=64 time=0.226 ms
64 bytes from localhost (::1): icmp_seq=2 ttl=64 time=0.204 ms
64 bytes from localhost (::1): icmp_seq=3 ttl=64 time=0.177 ms
64 bytes from localhost (::1): icmp_seq=4 ttl=64 time=0.187 ms
64 bytes from localhost (::1): icmp_seq=5 ttl=64 time=0.142 ms
64 bytes from localhost (::1): icmp_seq=6 ttl=64 time=0.142 ms
64 bytes from localhost (::1): icmp_seq=7 ttl=64 time=0.213 ms
^C
--- localhost ping statistics ---
7 packets transmitted, 7 received, 0% packet loss, time 137ms
rtt min/avg/max/mdev = 0.142/0.184/0.226/0.033 ms

brad@#########:~$ ping localhost

PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.194 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.131 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.130 ms
64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.133 ms
^C
--- localhost ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 80ms
rtt min/avg/max/mdev = 0.130/0.147/0.194/0.027 ms

/etc/hosts:

127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

if I ping 127.0.0.1 IPv4 is used, OK if I ping ::1 IPv6 is used, OK

It looks like the name resolution is not working from user but from root only.

4 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like