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