1

Im having trouble pinging google.com on ubuntu 20.04

david@Ptolemy:~$ ping google.com
PING google.com(syd09s22-in-x0e.1e100.net (2404:6800:4006:80e::200e)) 56 data bytes
From 2001:8003:7405:1200:faab:5ff:feca:8050 (2001:8003:7405:1200:faab:5ff:feca:8050) icmp_seq=1 Destination unreachable: Address unreachable
From 2001:8003:7405:1200:faab:5ff:feca:8050 (2001:8003:7405:1200:faab:5ff:feca:8050) icmp_seq=2 Destination unreachable: Address unreachable
From 2001:8003:7405:1200:faab:5ff:feca:8050 (2001:8003:7405:1200:faab:5ff:feca:8050) icmp_seq=3 Destination unreachable: Address unreachable
^C
--- google.com ping statistics ---
6 packets transmitted, 0 received, +3 errors, 100% packet loss, time 5071ms

I can ping google from my windows computer on the same network.

I can ping from my ubuntu computer the default gateway

david@Ptolemy:~$ ip r
default via 10.0.0.138 dev eno1 proto dhcp metric 100 
10.0.0.0/24 dev eno1 proto kernel scope link src 10.0.0.28 metric 100 
169.254.0.0/16 dev eno1 scope link metric 1000 

david@Ptolemy:~$ ping 10.0.0.138
PING 10.0.0.138 (10.0.0.138) 56(84) bytes of data.
64 bytes from 10.0.0.138: icmp_seq=1 ttl=64 time=0.528 ms
64 bytes from 10.0.0.138: icmp_seq=2 ttl=64 time=0.492 ms
64 bytes from 10.0.0.138: icmp_seq=3 ttl=64 time=0.491 ms
64 bytes from 10.0.0.138: icmp_seq=4 ttl=64 time=0.491 ms
64 bytes from 10.0.0.138: icmp_seq=5 ttl=64 time=0.565 ms
64 bytes from 10.0.0.138: icmp_seq=6 ttl=64 time=0.507 ms
^C
--- 10.0.0.138 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5113ms
rtt min/avg/max/mdev = 0.491/0.512/0.565/0.027 ms

Here is some other settings:

david@Ptolemy:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 04:92:26:5c:a2:ea brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.28/24 brd 10.0.0.255 scope global dynamic noprefixroute eno1
       valid_lft 85865sec preferred_lft 85865sec
    inet6 2001:8003:7405:1200:b479:aa32:55aa:acf5/64 scope global temporary dynamic 
       valid_lft 2911sec preferred_lft 2911sec
    inet6 2001:8003:7405:1200:88b2:8fdf:2a6e:c736/64 scope global dynamic mngtmpaddr noprefixroute 
       valid_lft 2911sec preferred_lft 2911sec
    inet6 fe80::318d:29eb:dfbb:ab2e/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

and my iptables has default rules as below:

david@Ptolemy:~$ sudo iptables -L
[sudo] password for david: 
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination  

Does anybody have an idea of how this can be fixed? Thanks.

UPDATE Re: @Jurrie questions I tried ping -4 google.com on both machines, and it does work. I then explicity tried ping -6 google.com on both machines. That delivers the same destination unreachable error now on both machines, so we are on the right track thanks to you.

david@Ptolemy:~$ ip -6 r
::1 dev lo proto kernel metric 256 pref medium
2001:8003:7405:1200::/64 via fe80::faab:5ff:feca:8050 dev eno1 proto ra metric 100 pref medium
fe80::/64 dev eno1 proto kernel metric 100 pref medium
default via fe80::faab:5ff:feca:8050 dev eno1 proto ra metric 20100 pref medium

So I went into my gateway page and the network settings "Local IPv4 Address" is set to the one we have seen 10.0.0.138, however in this table down the bottom there are two IPv6 settings that are left blank, ie. not set. Link Local Gateway IPv6 Address Globale Gateway IPv6 Address

I will have to find out how to configure ipv6 for my gateway I believe, or do I configure ubuntu to use ipv4. Which is more preferred?

More testing results and strange behaviour -

I changed the gai.conf back to the original state by commenting out your advised line precedence ::ffff:0:0/96 100 rebooted and then ran the following tests. Note how pinging google with no options fails with host unreachable message, where pining amazon works. Then note that ping -6 does not work for either, but producing different messages. I'm thinking that ubuntu is back to using ipv6 for ping, but why is the amazon.com working with normal ping if this is so?

david@Ptolemy:~$ ping www.google.com
PING www.google.com(syd09s23-in-x04.1e100.net (2404:6800:4006:80f::2004)) 56 data bytes
From 2001:8003:7405:1200:faab:5ff:feca:8050 (2001:8003:7405:1200:faab:5ff:feca:8050) icmp_seq=1 Destination unreachable: Address unreachable
From 2001:8003:7405:1200:faab:5ff:feca:8050 (2001:8003:7405:1200:faab:5ff:feca:8050) icmp_seq=2 Destination unreachable: Address unreachable
From 2001:8003:7405:1200:faab:5ff:feca:8050 (2001:8003:7405:1200:faab:5ff:feca:8050) icmp_seq=3 Destination unreachable: Address unreachable
From 2001:8003:7405:1200:faab:5ff:feca:8050 (2001:8003:7405:1200:faab:5ff:feca:8050) icmp_seq=4 Destination unreachable: Address unreachable
From 2001:8003:7405:1200:faab:5ff:feca:8050 (2001:8003:7405:1200:faab:5ff:feca:8050) icmp_seq=5 Destination unreachable: Address unreachable
From 2001:8003:7405:1200:faab:5ff:feca:8050 (2001:8003:7405:1200:faab:5ff:feca:8050) icmp_seq=6 Destination unreachable: Address unreachable
^X^C
--- www.google.com ping statistics ---
8 packets transmitted, 0 received, +6 errors, 100% packet loss, time 7090ms

david@Ptolemy:~$ ping www.amazon.com
PING d3ag4hukkh62yn.cloudfront.net (13.224.176.180) 56(84) bytes of data.
64 bytes from server-13-224-176-180.syd1.r.cloudfront.net (13.224.176.180): icmp_seq=1 ttl=244 time=22.1 ms
64 bytes from server-13-224-176-180.syd1.r.cloudfront.net (13.224.176.180): icmp_seq=2 ttl=244 time=21.9 ms
64 bytes from server-13-224-176-180.syd1.r.cloudfront.net (13.224.176.180): icmp_seq=3 ttl=244 time=21.8 ms
^X64 bytes from server-13-224-176-180.syd1.r.cloudfront.net (13.224.176.180): icmp_seq=4 ttl=244 time=21.7 ms
^C
--- d3ag4hukkh62yn.cloudfront.net ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 21.661/21.860/22.090/0.160 ms
david@Ptolemy:~$ ping -6 www.google.com
PING www.google.com(syd09s23-in-x04.1e100.net (2404:6800:4006:80f::2004)) 56 data bytes
From 2001:8003:7405:1200:faab:5ff:feca:8050 (2001:8003:7405:1200:faab:5ff:feca:8050) icmp_seq=1 Destination unreachable: Address unreachable
From 2001:8003:7405:1200:faab:5ff:feca:8050 (2001:8003:7405:1200:faab:5ff:feca:8050) icmp_seq=2 Destination unreachable: Address unreachable
From 2001:8003:7405:1200:faab:5ff:feca:8050 (2001:8003:7405:1200:faab:5ff:feca:8050) icmp_seq=3 Destination unreachable: Address unreachable
^C
--- www.google.com ping statistics ---
4 packets transmitted, 0 received, +3 errors, 100% packet loss, time 3026ms

david@Ptolemy:~$ ping -6 www.amazon.com
ping: www.amazon.com: Name or service not known
david@Ptolemy:~$ ping -4 www.google.com
PING www.google.com (142.250.66.196) 56(84) bytes of data.
64 bytes from syd09s23-in-f4.1e100.net (142.250.66.196): icmp_seq=1 ttl=115 time=22.3 ms
64 bytes from syd09s23-in-f4.1e100.net (142.250.66.196): icmp_seq=2 ttl=115 time=27.1 ms
64 bytes from syd09s23-in-f4.1e100.net (142.250.66.196): icmp_seq=3 ttl=115 time=22.3 ms
64 bytes from syd09s23-in-f4.1e100.net (142.250.66.196): icmp_seq=4 ttl=115 time=22.3 ms
64 bytes from syd09s23-in-f4.1e100.net (142.250.66.196): icmp_seq=5 ttl=115 time=21.9 ms
^X64 bytes from syd09s23-in-f4.1e100.net (142.250.66.196): icmp_seq=6 ttl=115 time=22.2 ms
^C
--- www.google.com ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5007ms
rtt min/avg/max/mdev = 21.931/23.008/27.081/1.825 ms
david@Ptolemy:~$ ping -4 www.amazon.com
PING e15316.e22.akamaiedge.net (23.217.176.20) 56(84) bytes of data.
64 bytes from a23-217-176-20.deploy.static.akamaitechnologies.com (23.217.176.20): icmp_seq=1 ttl=60 time=9.58 ms
64 bytes from a23-217-176-20.deploy.static.akamaitechnologies.com (23.217.176.20): icmp_seq=2 ttl=60 time=9.31 ms
64 bytes from a23-217-176-20.deploy.static.akamaitechnologies.com (23.217.176.20): icmp_seq=3 ttl=60 time=9.36 ms
^C
--- e15316.e22.akamaiedge.net ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 9.305/9.414/9.578/0.117 ms
2
  • I have some more information if you have time to look at it @Jurrie. I changed the gai.conf back to original state, rebooted and tested with amazon instead of google, and surprising results, please see if you can identify what is happening here.
    – Bucephalus
    Aug 17 '20 at 14:04
  • If you see in the very first line of the feedback of the first two pings, the google address is an ipv6 address and the amazon address is an ipv4 address. Does this give us insight into what my computer is doing or more what their server is doing?
    – Bucephalus
    Aug 17 '20 at 14:17
2

Pinging google.com from your Ubuntu installation is done using IPv6.

You mention you can ping google.com from Windows on the same network - is this also using IPv6? Or is it using the older IPv4 variant?

If Windows is using IPv4 - could you try ping -4 google.com in Ubuntu and see if that works? If it does, we can be sure the problem is IPv6 based. If it does not work, something completely different is wrong. (Though I do not see what exactly.)

The diagnostic commands you give are all IPv4 based. We need the IPv6 equivalents.

Could you try:

  • ip -6 r to list your IPv6 routes
  • ping -6 [your-default-gateway-here]%[iface-to-use-for-default-gateway] to ping your default gateway using IPv6
  • sudo ip6tables -L to list your IPv6 firewall rules

And list those outputs here?

Update

To IPv6 or not to IPv6?

You ask whether IPv4 or IPv6 is preferred.

Computers that are connected to a network (like the Internet) are given unique numbers. These are either IPv4 numbers or IPv6 numbers. IPv4 numbers look like 52.142.124.215, while IPv6 numbers look like 2001:9a8:0:e:1337:0:80:1. The IPv4 number scheme allows for a maximum of 2³² unique addresses (though a bunch of those are reserved for special purposes or for private networks). Believe it or not, this is not enough nowadays. IPv6 was invented to fix this (and more) - it allows for a maximum of 2¹²⁸ unique addresses. This is why in general I would say you should prefer IPv6.

But, you say your ISP does not support IPv6. It's a shame, ISPs have been given plenty of time to support IPv6. But if not all devices between your Ubuntu machine and Google.com support IPv6, you can not do 'real IPv6'. (There is the option to do IPv6 over IPv4, but don't bother - switching ISPs is more likely a better solution.) Stick to using IPv4.

Why does Ubuntu try IPv6 when the ISP does not support it?

As said, computers use unique numbers to refer to other hosts. But we humans are not good in remembering such numbers as 52.142.124.215. We are good at remembering funny, random words, like "Duck Duck Go!". (In fact, you've already remembered it now: duckduckgo.com is a privacy friendly search engine.) So, in the background, we use a system called DNS which translates duckduckgo.com into 52.142.124.215.

ISPs all run DNS servers for this, and there are also public DNS servers that are not ISP-specific.

Your Ubuntu machine asked its DNS resolver: "Hey, what's the IP number for google.com?", and the DNS server responded "That would be 2404:6800:4006:80e::200e good sir". However, that's an IPv6 address, and your ISP does not support it.

So it makes me wonder which DNS servers you use? Could you check this in your network settings? Try to use the DNS servers provided by your ISP. Most often, ISPs suggest using DHCP, which will make your computer automatically use the ISP DNS servers.

If you are already using your ISP's DNS servers, or you can not use them, or you do not want to use them, you should configure Ubuntu to prefer IPv4 addresses even though an IPv6 address for the requested DNS name is available.

Prefer IPv4 addresses when doing DNS lookup

Programs on Linux do DNS to IP resolution using the function getaddressinfo. That function has a configuration file: /etc/gai.conf. Open it using a text editor, and add a line at the bottom saying:

precedence ::ffff:0:0/96  100

On my system, this changes ping google.com from using IPv6 to IPv4. (Note that this part on getaddressinfo was taken from this answer.)

9
  • I have edited my original post to give you an update @Jurrie
    – Bucephalus
    Aug 16 '20 at 0:17
  • hi @Jurrie from my brief reading it looks like my ISP may not provide ipv6 yet. So it seems my windows computer knows to use ipv4 but my ubuntu computer does not. Should the Ubuntu computer be able to pick this up and know to use ipv4? Or is there a reason it is trying to use ipv6 even though the gateway only has a ipv4 interface set?
    – Bucephalus
    Aug 16 '20 at 0:29
  • Well i just used a website called "whatsmydnsserver.com". It tells me that I'm using dns server 61.9.211.40 and that it's owned by Telstra, which is my ISP provider here in Australia.
    – Bucephalus
    Aug 16 '20 at 12:37
  • Can you tell anything more about it from your knowledge of network tools? @Jurrie
    – Bucephalus
    Aug 16 '20 at 12:38
  • 1
    @Bucephalus when you use ping -6, you should use an IPv6 address. 61.9.211.40 is an IPv4 address. You should use ping -4 61.9.211.40 for that (and it will work). It's not a sign your ISP doesn't support IPv6; it's more like speaking Chinese to an American... 😀
    – Jurrie
    Aug 17 '20 at 12:12

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.