skip to Main Content

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.

2

Answers


  1. 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

    Login or Signup to reply.
  2. 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!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search