Все, что связано с сетью, похоже, не работает Ubuntu 16.04 - PullRequest
0 голосов
/ 20 сентября 2018

Вчера я разрабатывал панель управления на своем сервере, используя PHP и MySQL.Я пришел сегодня, чтобы закончить указанную панель инструментов и получил следующий вывод:

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

Если углубиться в эту проблему, я сталкиваюсь со следующими проблемами также с 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.

Пытаясь разрешить хост apt-get, я получаю следующее:

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

Я подумал, что это будет проблемой DNS, поэтому я проверил свой файл resolv.conf и получил следующий вывод:

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

Итак, теперь я потерян, что происходит и как я могу успешно решить эту проблему?

РЕДАКТИРОВАТЬ:

ifconfig показывает, что у меня IP-адрес, как и ожидалось:

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 

1 Ответ

0 голосов
/ 20 сентября 2018

Мне удалось полностью решить эту проблему с помощью следующего:

$ sudo dpkg-reconfigure resolvconf
$ sudo cat<<EOF > /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 8.8.8.8
nameserver 8.8.4.4
EOF
$ /etc/init.d/networking restart
$ sudo ifdown <INTERFACE>
$ sudo ifup <INTERFACE>
...