Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
293 views
in Technique[技术] by (71.8m points)

networking - Everything network related seems to be down Ubuntu 16.04

Yesterday I was developing a dashboard on my server using PHP and MySQL. I came in today to finish said dashboard and am met with the following output:

git clone https://github.com/tbg/tcd
Cloning into 'tcd'...
fatal: unable to access 'https://github.com/tbg/tcd/': Could not resolve host: github.com

Looking deeper into this issue I cam across the following issues as well with apt-get:

apt-get update
Err:1 http://ppa.launchpad.net/certbot/certbot/ubuntu xenial InRelease
  Could not resolve 'ppa.launchpad.net'
Err:2 http://security.ubuntu.com/ubuntu xenial-security InRelease                                            
  Could not resolve 'security.ubuntu.com'
Err:3 http://ppa.launchpad.net/ondrej/php/ubuntu xenial InRelease                                            
  Could not resolve 'ppa.launchpad.net'
Err:4 http://us.archive.ubuntu.com/ubuntu xenial InRelease               
  Could not resolve 'us.archive.ubuntu.com'
Err:5 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease       
  Could not resolve 'us.archive.ubuntu.com'
Err:6 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease
  Could not resolve 'us.archive.ubuntu.com'
Err:7 https://download.docker.com/linux/ubuntu xenial InRelease
  Could not resolve host: download.docker.com
Err:8 https://deb.nodesource.com/node_8.x xenial InRelease
  Could not resolve host: deb.nodesource.com
Err:9 http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 InRelease
  Could not resolve 'repo.mongodb.org'
Reading package lists... Done      
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/xenial/InRelease  Could not resolve 'us.archive.ubuntu.com'
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease  Could not resolve 'us.archive.ubuntu.com'
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/xenial-backports/InRelease  Could not resolve 'us.archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/InRelease  Could not resolve 'security.ubuntu.com'
W: Failed to fetch https://download.docker.com/linux/ubuntu/dists/xenial/InRelease  Could not resolve host: download.docker.com
W: Failed to fetch http://ppa.launchpad.net/certbot/certbot/ubuntu/dists/xenial/InRelease  Could not resolve 'ppa.launchpad.net'
W: Failed to fetch http://repo.mongodb.org/apt/ubuntu/dists/xenial/mongodb-org/3.2/InRelease  Could not resolve 'repo.mongodb.org'
W: Failed to fetch https://deb.nodesource.com/node_8.x/dists/xenial/InRelease  Could not resolve host: deb.nodesource.com
W: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/dists/xenial/InRelease  Could not resolve 'ppa.launchpad.net'
W: Some index files failed to download. They have been ignored, or old ones used instead.

Trying to resolve the apt-get host I get the following:

host -v us.archive.ubuntu.com
Trying "us.archive.ubuntu.com"
;; connection timed out; no servers could be reached

I figured this would be a DNS issue so I checked my resolv.conf file and am met with the following output:

cat /etc/resolv.conf
cat: /etc/resolv.conf: No such file or directory

So now I'm lost, what's going on and how can I fix this issue successfully?

EDIT:

ifconfig shows that I have an IP address as expected:

eno1      Link encap:Ethernet  HWaddr d0:94:67:41:8b:b3  
          inet addr:10.1.1.78  Bcast:10.1.1.255  Mask:255.255.255.0
          inet6 addr: fe80::d294:66ff:fe51:5bb3/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:13800 errors:0 dropped:1 overruns:0 frame:0
          TX packets:2420 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:4767680 (4.7 MB)  TX bytes:559473 (559.4 KB)
          Interrupt:17 
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I had the same issue on Ubuntu:

Run:

systemctl enable systemd-resolved --now
ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
nano /etc/systemd/resolved.conf 

and add the relevant DNS, for example: DNS=8.8.8.8


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...