5

I am unable to access github at all from the command line on a newly installed Ubuntu server. Pinging and curling github fails but works fine for other hosts.

OS: Ubuntu 22.04.1 LTS

Ping test

# google
ping -c3 google.com
PING google.com(ord37s32-in-x0e.1e100.net (2607:f8b0:4009:808::200e)) 56 data bytes
64 bytes from ord31s21-in-x0e.1e100.net (2607:f8b0:4009:808::200e): icmp_seq=1 ttl=115 time=16.6 ms
64 bytes from ord37s32-in-x0e.1e100.net (2607:f8b0:4009:808::200e): icmp_seq=2 ttl=115 time=15.2 ms
64 bytes from ord37s32-in-x0e.1e100.net (2607:f8b0:4009:808::200e): icmp_seq=3 ttl=115 time=10.9 ms

--- google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2004ms
rtt min/avg/max/mdev = 10.914/14.210/16.553/2.398 ms

# github - fails with 'Destination Host Unreachable'
ping -c3 github.com
PING github.com (140.82.113.3) 56(84) bytes of data.
From ubuntu (192.168.0.38) icmp_seq=1 Destination Host Unreachable
From ubuntu (192.168.0.38) icmp_seq=2 Destination Host Unreachable
From ubuntu (192.168.0.38) icmp_seq=3 Destination Host Unreachable

--- github.com ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2026ms
pipe 3

# github ping -4
ping -c3 github.com
PING github.com (140.82.112.4) 56(84) bytes of data.
From ubuntu (192.168.0.38) icmp_seq=1 Destination Host Unreachable
From ubuntu (192.168.0.38) icmp_seq=2 Destination Host Unreachable
From ubuntu (192.168.0.38) icmp_seq=3 Destination Host Unreachable

--- github.com ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2020ms
pipe 2

curl test

# google
curl -s --head --request GET google.com > /dev/null; echo $?
0

# github
curl -s --head --request GET github.com > /dev/null; echo $?
7

git clone test

# Fails with 'no route to host'.
git clone https://github.com/pi-hole/pi-hole.git
Cloning into 'pi-hole'...
fatal: unable to access 'https://github.com/pi-hole/pi-hole.git/': Failed to connect to github.com port 443 after 18534 ms: No route to host

nslookup

# google
nslookup google.com
Server:     127.0.0.53
Address:    127.0.0.53#53

Non-authoritative answer:
Name:   google.com
Address: 142.250.191.206
Name:   google.com
Address: 2607:f8b0:4009:803::200e

# github
nslookup github.com
Server:     127.0.0.53
Address:    127.0.0.53#53

Non-authoritative answer:
Name:   github.com
Address: 140.82.112.4

ip r s

ip r s
default via 192.168.0.1 dev enp0s31f6 proto dhcp src 192.168.0.38 metric 100 
1.1.1.3 via 192.168.0.1 dev enp0s31f6 proto dhcp src 192.168.0.38 metric 100 
192.168.0.0/24 dev enp0s31f6 proto kernel scope link src 192.168.0.38 metric 100 
192.168.0.1 dev enp0s31f6 proto dhcp scope link src 192.168.0.38 metric 100 
192.168.0.38 dev enp0s31f6 proto dhcp scope host src 192.168.0.38 metric 100 

ifconfig

ifconfig
enp0s31f6: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.38  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 2601:246:4d7f:8361:d681:d7ff:fe8d:637b  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::d681:d7ff:fe8d:637b  prefixlen 64  scopeid 0x20<link>
        ether d4:81:d7:8d:63:7b  txqueuelen 1000  (Ethernet)
        RX packets 231023  bytes 191591697 (191.5 MB)
        RX errors 0  dropped 8  overruns 0  frame 0
        TX packets 174168  bytes 16427225 (16.4 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 16  memory 0xef200000-ef220000  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 10709  bytes 1034079 (1.0 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 10709  bytes 1034079 (1.0 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

traceroute

# google
traceroute to google.com (172.217.1.110), 30 hops max, 60 byte packets
 1  ubuntu (192.168.0.38)  3060.551 ms !H  3060.478 ms !H  3060.429 ms !H

# github
traceroute to github.com (140.82.114.4), 30 hops max, 60 byte packets
 1  ubuntu (192.168.0.38)  3049.846 ms !H  3049.774 ms !H  3049.725 ms !H

I am not, to my knowledge, dealing with any proxies or abnormal firewall setup.

Thanks for any advice.

user9074332
  • 2,336
  • 2
  • 23
  • 39
  • https://askubuntu.com/questions/1254542/cannot-ping-github – juzraai Oct 17 '22 at 19:18
  • Hi, thanks for the response, the recommended post did not help the issue - there are no custom entries in `/etc/hosts`. I've updated the nslookup resolves above and I'm not seeing any immediate reason to believe it's a dns issue but could be wrong. – user9074332 Oct 18 '22 at 01:51
  • Due to the address 127.0.0.53 that looks to me as we're dealing with docker or some other virtualization. Therefore is this maybe a duplicate of https://stackoverflow.com/questions/38227029/ and has something to do with docker networking setup? – hiddenAlpha Oct 20 '22 at 19:21
  • Thanks for the response but there is no Docker or virtualization, this is a clean ubuntu server install on a personal laptop. – user9074332 Oct 21 '22 at 13:08
  • it may be temporary problem with route to IPv4: 140.82.112.4 try to change your DNS servers to google's: 8.8.8.8 or replace github.com IP to 140.82.121.4 – Vladimir Miroshnichenko Oct 27 '22 at 01:38
  • same issue when trying to ping the IP - `Destination Host Unreachable` – user9074332 Nov 09 '22 at 03:57

2 Answers2

0

For IPv4/6 related issue:

It seems that you only get an answer from IPv6 ip's and GitHub sadly does not provide a IPv6 address yet, more on that topic can be found here.

They recently started testing support for it internally.

Please provide the output of ip r s and/or ifconfig and traceroute google.com as well as traceroute github.com.

Further try ping -c3 -4 github.com - if they go through the easiest way would be to deactivate IPv6 for the NIC in use.

To temporarily disable IPv6:

$ sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.all.disable_ipv6 = 1
$ sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6 = 1

and test again - if it works feel free to permanently disable IPv6 (if desired) by adjusting the line GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub to read GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1"

and finally run sudo update-grub to have ipv6 disabled permanently disabled

For DNS related issue (unlikely in this case):

can you check systemd-resolve --status? If it uses a "proper" DNS Server like Google 8.8.8.8 or in fact the DNS from your provider/router?

In case it uses a DNS server from your provider/router I'd suggest changing it to 8.8.8.8. Probably best to check on how to achieve that as we don't know whether you have GUI enabled or not it is kinda hard to provide a fully working answer.

For a CLI Setup (using Google DNS): sudo nano /etc/netplan/01-network-manager.yaml and add nameservers to use for the desired interface

    nameservers:
        addresses: [8.8.8.8, 8.8.4.4]

save and exit the file and run sudo netplan try to verify the configuration file is valid. If so apply it with sudo netplan apply

James Risner
  • 5,451
  • 11
  • 25
  • 47
sengra
  • 1
  • 2
  • Thanks for the response, I updated the original question with some of your inquiries. I am reluctant to disable all of ipv6. Also I did not have the `systemd-resolve` command on this new ubuntu server install. Also, I could not get the `/etc/netplan/01-network-manager.yaml` format correct so the `netplan try` kept throwing a `Failed to start NetworkManager.service: Unit NetworkManager.service not found.` error message. – user9074332 Oct 27 '22 at 02:28
  • Given the 1.1.1.3 route already being in place and the missing off systemd-resolve could it be that you ran `curl -sSL https://install.pi-hole.net | bash` prior to trying to access github? If that is the case you most likely already have a somewhat working pi-hole setup. However, I'd recommend to start over with a fresh install (perhaps on a secondary drive) and see whether the commands exist, because `systemd-resolve` to my knowledge should be working and be there by default. – sengra Oct 27 '22 at 08:20
  • This machine did have pi-hole on it previously but was wiped clean with a new ubuntu server install. The pi-hole `curl` driven install has never worked however, I've had to download a release tarball from github manually and then initiate the installation so this connectivity issue has always been a problem. – user9074332 Oct 27 '22 at 14:08
  • Are you entirely sure, that it was wiped clean? The default Ubuntu Server installation does not contain that route by default. It really looks like something went wrong during installation (maybe during drive setup it had "Do not format" selected and ended up booting the "old" system. If the command `git clone https://github.com/pi-hole/pi-hole.git` is runable from a different machine - within the same network - then solely the settings on the laptop can be at fault. Which, as stated, are not part of a default/clean installation – sengra Oct 27 '22 at 15:27
  • Yeah it was definitely wiped clean. Since it was previously setup as a pi-hole the static ip is still listed as a DNS server in the router. Could that be a problem? But it's still strange that this behavior is only affecting Github – user9074332 Oct 30 '22 at 18:00
0

I hate to ask, but I don't see any mention of an access token being used?

To access through cli you'll need an access token.

I'd also recommend using the gh cli instead of git. I suspect the issue being related to server being wiped and not having any credentials.

Take a look here for details on setting up access token to use with ssh. https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token

The easiest way to get started is by using the gh cli.

You can install it with the following commands

sudo apt update && sudo apt install gh

Then do

gh auth login

Hope this helps!

  • Hi, thanks for the response but I was attempting to clone a public repo that should not require an access token. Take for example https://github.com/pi-hole/pi-hole.git. But even if it was the issue, it wouldnt explain the inability to ping, nslookup, etc github.com. Thanks again. – user9074332 Nov 09 '22 at 02:49