3

I cannot access to GitHub only on my Ubuntu 18.04 machine and all other machines (Windows PC, iPad, Phone) connected to the same network can access GitHub.

When I try to ping GitHub, I get

result of ping github.com

The result of run nslookup github.com:

Server:     127.0.0.53
Address:    127.0.0.53#53

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

If I try sudo route -n:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.178.1   0.0.0.0         UG    600    0        0 wlp4s0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 wlp4s0
192.168.178.0   0.0.0.0         255.255.255.0   U     600    0        0 wlp4s0

If I ping google.com, it works.

I can't access GitHub in the browser also. However, all other websites work fine. Also, I can access GitHub on other devices. Is there anything wrong with the DNS?

Kulfy
  • 17,696
  • There is something wrong with the IP address. When I lookup github.com the IP is 140.82.113.4. It looks like that you may have a DNS problem. – NK_ Jun 28 '20 at 14:13
  • @NK_ When I typed in the IP you gave (140.82.113.4) in the browser, I noticed the address was redirected to github.com. And same to the IP address I provided (192.30.253.112), the address was also redirected to github.com. The only problem is that the site "can't be reached", so I would say the IP address is correct. It's different just because that different DNS resolve the address of github.com differently according to the location. – zzhuolun Jun 28 '20 at 19:39
  • Looks like you are correct joeller. Do you mean you cannot access both 140.82.113.4 and 192.30.253.112 on your browser? Just a little possibility, but maybe enabling location services might help. – NK_ Jun 29 '20 at 10:18

3 Answers3

4

I got exactly same problem below is how I solve it : In short : there might be a github.com mistakenly configured in

/etc/hosts
Please comment out item below , everything works right for me  
# Github
#192.30.253.113 github.com

https://stackoverflow.com/questions/62964265/cannot-ping-github-on-ubuntu1804-suspect-network-configration-issue/62964372#62964372

Jia
  • 101
0

Doing a reverse DNS lookup on the IP address posted in the question, reveals that this points to a DNS server with hostname dns1.p07.nsone.net rather than github.com.

$ dig -x 192.30.253.112

; <<>> DiG 9.11.3-1-Debian <<>> -x 192.30.253.112 ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 48141 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;112.253.30.192.in-addr.arpa. IN PTR

;; AUTHORITY SECTION: 253.30.192.in-addr.arpa. 3600 IN SOA dns1.p07.nsone.net. hostmaster.nsone.net. 1591647771 43200 7200 1209600 3600

;; Query time: 41 msec ;; SERVER: REDACTED#53(REDACTED) ;; WHEN: Sat Jul 18 16:59:59 CST 2020 ;; MSG SIZE rcvd: 121

In other words, this is a DNS problem. How to resolve the issue ?

  • attempt changing your nameserver (there are plenty of public nameservers to choose from, such as Google DNS 8.8.8.8, OpenDNS 206.67.220.220, Level 3 209.244.0.3, and others). There are several ways depending on your Ubuntu release. For the most recent ones, that can be done via netplan settings

  • If 192.30.253.112 is your ISP's nameserver, report the issue to their technical support so that the issue can be fixed on their end

Sergiy Kolodyazhnyy
  • 105,154
  • 20
  • 279
  • 497
-1

Your dns server is pointed to a loopback, therefore your own machine. You can change the dns servers by doing the following:

nano /etc/netplan/01-netcfg.yaml

Under nameservers then addresses enter this:

  nameservers:
      addresses: [8.8.8.8, 8.8.4.4]

Run this to apply the changes:

sudo netplan apply

Then to verify the changes have been made run this:

systemd-resolve --status | grep 'DNS Servers' -A2