Ubuntu ошибка dns

After upgrading to 20.04, both my wired and wireless networking lost access to the internet. I confirmed my drivers were working when I was able to resolve a ping to the Google nameserver 8.8.8.8. Now, every time I reboot, I have to manually edit /etc/resolv.conf and add line:

nameserver 8.8.8.8

I have been unable to get to a permanent resolution in both the network manager and netplan.

IPV4 tab in network manager under DNS set to manual

8.8.8.8, 8.8.4.4

/etc/netplan/01.yaml*

network:
version: 2
renderer: networkd
ethernets:
   wlp58s0:
      dhcp4: true
      nameservers:
         addresses: [8.8.8.8, 8.8.4.4]

If someone could please advise me on how to get my DNS settings configured properly, I would greatly appreciate it. Thanks.

asked May 29, 2020 at 12:44

Mykle's user avatar

The following worked for me.

sudo systemd-resolve --set-dns=8.8.8.8 --interface=<interface name> 

E.g. sudo systemd-resolve --set-dns=8.8.8.8 --interface=eth0.

Pablo Bianchi's user avatar

answered Dec 1, 2020 at 11:15

dpaks's user avatar

dpaksdpaks

2012 silver badges3 bronze badges

2

In Ubuntu 20.04, the expected configuration of /etc/resolv.conf is to point to a local systemd-networkd resolver:

nameserver 127.0.0.53

To check which upstream nameservers your local resolver is configured for, you can check the output of resolvectl status. This should show, for each of your network interfaces, the nameservers that have been associated.

You also show a netplan config that says to use the networkd renderer, but mention Network Manager in your question. If you are expecting your wireless interface to be manageable through NetworkManager, then you need to change this netplan config (or else, you have other netplan config already on your system that you didn’t list here).

answered May 29, 2020 at 17:59

slangasek's user avatar

slangasekslangasek

5,3132 gold badges18 silver badges26 bronze badges

5

The systemd-resolved.service became disabled, so once I enabled it and set it to auto start, my issues were resoled.

sudo systemctl enable systemd-resolved.service
sudo systemctl start systemd-resolved.service

Pablo Bianchi's user avatar

answered Jun 1, 2020 at 14:12

Mykle's user avatar

MykleMykle

3211 gold badge2 silver badges7 bronze badges

1

Changes to the /etc/resolv.conf files will only last for a while and is not persistent. To work around this and make changes to your nameservers in resolv.conf permanent do the following:

Open the dhclient.conf with superuser privileges

sudo nano /etc/dhcp/dhclient.conf

Find the following lines:

#supersede domain-name "fugue.com home.vix.com";
#prepend domain-name-servers 127.0.0.1;

Uncomment the above lines and use the domain-name and domain-name-servers which you want. Save it. Now the DNS related changes will be permanent.

answered May 29, 2020 at 13:06

ldias's user avatar

ldiasldias

1,9859 silver badges22 bronze badges

8

From /etc folder

sudo ln -sf ../run/systemd/resolve/resolv.conf resolv.conf

They did something weird with some last Ubuntu version. I faced the same intermittent DNS resolution issue with all my Ubuntu installation for the last year at least. This fix was tried and so far works Ok. By default the same file is pointed to stub. So do not know exactly what is the root cause. No time to investigate it. Hope they will fix it sooner or later.

answered Feb 19, 2022 at 5:45

Shtefan's user avatar

0

I could ping everything… No internet browser could resolve any sites…
My problem was a custom DHCPD config file.
Thankfully I saved original file, so reverted that file back…
& BOOM I was back in business.
My version is xubuntu 20.04, so dhcpd.conf is under /etc/dhcp

answered Jun 21 at 12:59

No One's user avatar

You must log in to answer this question.

Not the answer you’re looking for? Browse other questions tagged

.

  • Home
  • Forum
  • The Ubuntu Forum Community
  • Ubuntu Official Flavours Support
  • Networking & Wireless
  • [SOLVED] How to no connectivity Ubuntu DNS problem [fix]

  1. Smile How to no connectivity Ubuntu DNS problem [fix]

    I installed Ubuntu 17.04 and Ubuntu-Mate 17.04 and found i had no INTERNET access. It looked like a problem with DNS.

    Here are some simple solutions to the problem:

    Method 1:

    Open a terminal and copy and paste the following:

    Code:

    sudo gedit /etc/resolvconf/resolv.conf.d/tail

    Add the following:Click Save and Restart your computer.

    Method 2:

    Open a terminal and copy and paste the following:

    Code:

    sudo gedit /etc/systemd/resolved.conf

    Uncomment and change it toClick Save and Restart your computer.

    Method 3:

    With Network-manager Click Edit Connections > Wired Connection > Edit > Ipv4 Settings > Method: Automatic (DHCP) address only > DNS servers add 8.8.8.8 > Click Save

    Restart your Network Connection or restart your computer.

    With this method, if the connection under «Network Connections» is deleted the user will no longer have INTERNET access so i would not recommended it. Choose method 1 or 2 instead.

    Last edited by jonathonp; April 16th, 2017 at 05:50 AM.


  2. Re: How to no connectivity Ubuntu DNS problem [fix]

    I installed Ubuntu Gnome 17.04 on a spare partition and wired internet did not work.

    Method 2 in your post solved the difficulty.

    Thank you


  3. Re: How to no connectivity Ubuntu DNS problem [fix]

    Methode nr 1 SOLVED my problem with DNS on Ubuntu 17.04 ——- Thank You very much


  4. Re: How to no connectivity Ubuntu DNS problem [fix]

    The 2nd method worked for me too. Thanks!


  5. Re: How to no connectivity Ubuntu DNS problem [fix]

    The first method works like a charm. Thanks.
    Can you give a briefly explanation about how it works?

    Kind regards!


Bookmarks

Bookmarks


Posting Permissions

After upgrading to 20.04, both my wired and wireless networking lost access to the internet. I confirmed my drivers were working when I was able to resolve a ping to the Google nameserver 8.8.8.8. Now, every time I reboot, I have to manually edit /etc/resolv.conf and add line:

nameserver 8.8.8.8

I have been unable to get to a permanent resolution in both the network manager and netplan.

IPV4 tab in network manager under DNS set to manual

8.8.8.8, 8.8.4.4

/etc/netplan/01.yaml*

network:
version: 2
renderer: networkd
ethernets:
   wlp58s0:
      dhcp4: true
      nameservers:
         addresses: [8.8.8.8, 8.8.4.4]

If someone could please advise me on how to get my DNS settings configured properly, I would greatly appreciate it. Thanks.

asked May 29, 2020 at 12:44

Mykle's user avatar

The following worked for me.

sudo systemd-resolve --set-dns=8.8.8.8 --interface=<interface name> 

E.g. sudo systemd-resolve --set-dns=8.8.8.8 --interface=eth0.

Pablo Bianchi's user avatar

answered Dec 1, 2020 at 11:15

dpaks's user avatar

dpaksdpaks

2012 silver badges3 bronze badges

2

In Ubuntu 20.04, the expected configuration of /etc/resolv.conf is to point to a local systemd-networkd resolver:

nameserver 127.0.0.53

To check which upstream nameservers your local resolver is configured for, you can check the output of resolvectl status. This should show, for each of your network interfaces, the nameservers that have been associated.

You also show a netplan config that says to use the networkd renderer, but mention Network Manager in your question. If you are expecting your wireless interface to be manageable through NetworkManager, then you need to change this netplan config (or else, you have other netplan config already on your system that you didn’t list here).

answered May 29, 2020 at 17:59

slangasek's user avatar

slangasekslangasek

5,3132 gold badges18 silver badges26 bronze badges

5

The systemd-resolved.service became disabled, so once I enabled it and set it to auto start, my issues were resoled.

sudo systemctl enable systemd-resolved.service
sudo systemctl start systemd-resolved.service

Pablo Bianchi's user avatar

answered Jun 1, 2020 at 14:12

Mykle's user avatar

MykleMykle

3211 gold badge2 silver badges7 bronze badges

1

Changes to the /etc/resolv.conf files will only last for a while and is not persistent. To work around this and make changes to your nameservers in resolv.conf permanent do the following:

Open the dhclient.conf with superuser privileges

sudo nano /etc/dhcp/dhclient.conf

Find the following lines:

#supersede domain-name "fugue.com home.vix.com";
#prepend domain-name-servers 127.0.0.1;

Uncomment the above lines and use the domain-name and domain-name-servers which you want. Save it. Now the DNS related changes will be permanent.

answered May 29, 2020 at 13:06

ldias's user avatar

ldiasldias

1,9859 silver badges22 bronze badges

8

From /etc folder

sudo ln -sf ../run/systemd/resolve/resolv.conf resolv.conf

They did something weird with some last Ubuntu version. I faced the same intermittent DNS resolution issue with all my Ubuntu installation for the last year at least. This fix was tried and so far works Ok. By default the same file is pointed to stub. So do not know exactly what is the root cause. No time to investigate it. Hope they will fix it sooner or later.

answered Feb 19, 2022 at 5:45

Shtefan's user avatar

0

I could ping everything… No internet browser could resolve any sites…
My problem was a custom DHCPD config file.
Thankfully I saved original file, so reverted that file back…
& BOOM I was back in business.
My version is xubuntu 20.04, so dhcpd.conf is under /etc/dhcp

answered Jun 21 at 12:59

No One's user avatar

You must log in to answer this question.

Not the answer you’re looking for? Browse other questions tagged

.

Ubuntu 2

If you’re using Ubuntu 20.04.1 LTS, you may occasionally encounter an error stating “No DNS Servers Known”. This error typically arises when DNS resolution fails after a reboot. The root cause of this issue often lies in the /etc/resolv.conf file, which is managed by systemd-resolved and sometimes may not contain any DNS servers. This article provides a step-by-step guide on how to fix this error.

To fix the «No DNS Servers Known» error in Ubuntu 20.04.1 LTS, you can start by checking the /etc/resolv.conf symlink and updating it if necessary. Verify the netplan configuration or check the network configuration in the /etc/network/interfaces file. Make sure the DNS field in the /etc/systemd/resolved.conf file is properly configured with the desired DNS servers. Restart the systemd-resolved service and check the DNS settings using the systemd-resolve --status command.

  1. Checking the /etc/resolv.conf Symlink
  2. Verifying Netplan Configuration
  3. Checking systemd-resolve Configuration
  4. Restarting systemd-resolved
  5. Checking DNS Settings

Checking the /etc/resolv.conf Symlink

The first step in resolving this issue is to ensure that the symlink for /etc/resolv.conf points to /run/systemd/resolve/stub-resolv.conf. If it points to /etc/resolv.conf instead, you will need to update it.

You can do this by running the following command in your terminal:

sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf

Here, ln is the command to create a link, -sf is used to create a symbolic link and to remove existing destination files, and the two paths are the source file and the destination file respectively.

Verifying Netplan Configuration

If the /etc/netplan folder is empty, it means that netplan is not being used to configure the network. In this case, you should check the network configuration in the /etc/network/interfaces file.

Checking systemd-resolve Configuration

The DNS configuration for systemd-resolved is stored in the /etc/systemd/resolved.conf file. It’s crucial to ensure that the DNS field is properly configured with the desired DNS servers.

You can edit the file using a text editor and add the DNS server addresses. For example:

[Resolve]
DNS=8.8.8.8 8.8.4.4

Here, 8.8.8.8 and 8.8.4.4 are the Google DNS servers that are being used as an example. You can replace these with the DNS servers of your choice.

Restarting systemd-resolved

After making changes to the configuration files, you need to restart the systemd-resolved service to apply these changes. You can do this by running the following command:

sudo systemctl restart systemd-resolved

In this command, systemctl is a utility that allows you to control the systemd system and service manager, and restart is the action to restart a service.

Checking DNS Settings

Finally, you can use the systemd-resolve --status command to check the current DNS settings. This command will display information about the DNS servers, search domains, and other relevant details.

systemd-resolve --status

If none of these solutions resolve the issue, it may be helpful to investigate further by checking the output of journalctl -b and searching for systemd-resolved messages. This can provide additional insights into any errors or warnings related to DNS resolution.

In summary, sporadic DNS resolution failures after a reboot on Ubuntu 20.04 can be fixed by ensuring the correct symlink for /etc/resolv.conf, verifying netplan or /etc/network/interfaces configuration, checking systemd-resolved configuration in /etc/systemd/resolved.conf, restarting systemd-resolved, and checking DNS settings using systemd-resolve --status. By following these steps, you should be able to resolve the “No DNS Servers Known” error and ensure smooth operation of your Ubuntu system.

The /etc/resolv.conf file is a configuration file that contains information about DNS (Domain Name System) servers. It is used by the system to resolve domain names to IP addresses.

You can check the current symlink for /etc/resolv.conf by running the following command in your terminal: ls -l /etc/resolv.conf. This will display the symlink target and the path it points to.

Yes, you can use DNS servers of your choice. Simply edit the /etc/systemd/resolved.conf file and replace the example DNS server addresses (8.8.8.8 8.8.4.4) with the addresses of the DNS servers you want to use.

You can use the systemd-resolve --status command to check the current DNS settings. This command will display information about the DNS servers, search domains, and other relevant details.

If none of the solutions mentioned in the article resolve the error, you can investigate further by checking the output of journalctl -b and searching for systemd-resolved messages. This can provide additional insights into any errors or warnings related to DNS resolution.

Имеем:
— Ubuntu 16.04 (десктопный вариант) установлена на виртуальной машине;
— выход в Интернет осуществлён через NAT.

До недавнего времени всё работала отлично без нареканий, но вот пару дней назад во время загрузки ОС начало вылазить такое сообщение об ошибке:

«failed to start clean up any mess left by 0dns-up»

При попытке открыть в браузере любой сайт в Интернете — ошибка, но ресурсы успешно пингуются.

Ввел команды по тестированию работы DNS:
nslookup
host
dig

В результате все эти команды дают один ответ: «connection timed out; no servers could be reached», то есть DNS-имена не резолвятся.

Выполняю в терминале команду:
sudo systemctl status dns-clean.service

И получаю вот такой ответ:
● dns-clean.service — Clean up any mess left by 0dns-up
   Loaded: loaded (/lib/systemd/system/dns-clean.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Суб 2018-03-17 21:13:02 EET; 3min 5s ago
  Process: 424 ExecStart=/etc/ppp/ip-down.d/0dns-down 0dns-clean (code=exited, status=203/EXEC)
  Process: 398 ExecStartPre=/bin/mkdir /var/run/pppconfig (code=exited, status=0/SUCCESS)
 Main PID: 424 (code=exited, status=203/EXEC)

Мар 17 21:13:02 Nginx-ubuntu16 systemd[1]: Starting Clean up any mess left by 0dns-up…
Мар 17 21:13:02 Nginx-ubuntu16 systemd[1]: dns-clean.service: Main process exited, code=exited, status=203/EXEC
Мар 17 21:13:02 Nginx-ubuntu16 systemd[1]: Failed to start Clean up any mess left by 0dns-up.
Мар 17 21:13:02 Nginx-ubuntu16 systemd[1]: dns-clean.service: Unit entered failed state.
Мар 17 21:13:02 Nginx-ubuntu16 systemd[1]: dns-clean.service: Failed with result ‘exit-code’.

Результат выполнения «journalctl -xe» в прикреплённом файле journalctl.txt

На просторах Инета нашёл рекомендацию, что в файл «/lib/systemd/system/ dns-clean.service» нужно добавить ключ «-р», чтобы в итоге строка получилась «ExecStartPre=/bin/mkdir -p /var/run/pppconfig»безрезультатно.

PPP-соединение на этой ВМ не использовал и даже никогда не пытался настраивать!!!

Гугление пока действенных результатов не дало.

При этом на другой ВМ из такой же ОС — всё отлично работает.

Подскажите, пожалуйста, какие есть варианты решения данной задачи.


АПД. После долгих поисков пришла мысль: «а что если эта проблема связана с глюком в работе Network Manager». В связи с чем, решил вычистить последний из системы. Для этого последовательно выполнил следующие действия.

1. Остановил и отключил службу NetworkManager:
sudo systemctl stop NetworkManager
sudo systemctl disable NetworkManager

2. Удалил из системы ссылки на службу NetworkManager:
sudo update-rc.d NetworkManager remove

3. Удалил все, что связано с NetworkManager:
sudo apt-get apt-get purge network-manager
sudo apt-get -f install
sudo apt-get purge network-manager-gnome
sudo apt-get -f install

4. После всех манипуляций настроил сеть ручками в следующих файлах:
/etc/network/interfaces
/etc/resolv.conf

Далее перезагрузил машину, но в результате симптомы остались те же, как впрочем и ошибка. То есть выяснил, что NetworkManager к данной проблеме пока не причастен.

Так что решение вопроса пока не нашёл. Попробую копать дальше, но уже в фоновом режиме. Буду рад услышать/прочитать дельные советы и подсказки!


Это глюк Network Manager, возможно только на виртуалках (на железе не сталкивались, хотя десктопов на Linux у нас мало). Способа лечения не нашли, да и особо не искали, настроили сеть «по-старинке», через конфиги и работаем дальше.

При настройке через конфиги обратите внимание на имена интерфейсов, после перехода на systemd вместо привычных ethx могут быть имена на основе моделей адаптеров.

  • 1 пользователю нравится это сообщение.


Спасибо Вам, Андрей, за помощь!
Мне видимо еще пока не хватает опыта, дабы понять, что у «Network Manager» даже при удалении остаются какие-то хвосты в зависимостях, которые вместе с ним не удаляются и продолжают сыпать ошибками…

Всё эти ковыряния делал исключительно для себя в образовательных целях, пока ещё есть время на эксперименты. Дабы в будущем иметь опыт в решении подобных проблем, в случае возникновения схожих ситуаций.


А вы его не трогайте, просто настройте сеть руками, все будет работать, только Network Manager будет показывать что сетевой кабель не подключен или что-то такое.

Р.S. Специально посмотрел, значок в панели показывает, что сеть подключена вне зависимости от реального состояния дел, если на него нажать, то будет написано что сеть «Не управляется».

  • 1 пользователю нравится это сообщение.


Таки решил «проблему», указанную в названии темы данной статьи. Хотя и прошло уже достаточно много времени с момента возникновения этой неприятной ситуации, но снапшот ВМ-ки таки решил еще тогда оставить. Поэтому отпишусь тут — может кому-то в будущем еще пригодится :)

И так по порядку.
1. Оказывается, что последние версии как Ubuntu 16.04, так и Ubuntu 18.04 «из коробки» идут со встроенной службой «systemd-resolve», которая и отвечает за функционирование DNS в ОС.

2. Поэтому отключим эту службу resolved service:
sudo systemctl disable systemd-resolved
sudo systemctl stop systemd-resolved

3. Также следует удалить символьную ссылку на файл resolv.conf
sudo ls -lh /etc/resolv.conf
sudo rm /etc/resolv.conf

4. Теперь настроим сеть вручную через конфиг (не трогая Network Manager)
mcedit /etc/network/interfaces

auto ens33
 iface ens33 inet static
   address 192.168.170.133
   netmask 255.255.255.0
   gateway 192.168.170.2
   dns-nameservers 8.8.8.8

На моем тестовом компьютере сетевая карта определяется ОС как «ens33», а Вы у себя посмотрите, как её идентифицирует Ваша система и замените название. Кроме того, в приведенном выше конфиге я указал DNS-сервер Google (dns-nameservers 8.8.8.8 ) с целью тестирования, но Вы можете заменить на свои.

5. С целью проверки работоспособности службы DNS, создадим новый файл resolv.conf (который при рестарте ОС должен перезаписаться)

echo «nameserver 8.8.8.8» > /etc/resolv.conf

После проделанных шагов — сеть заработала, команды nslookup, host и dig начали успешно отрабатывать — правильно разрешая DNS-имена, а в браузере наконец-то появился доступ в Интернет!

Выражаю ОГРОМНУЮ благодарность администрации данного форума за правильный вектор движения в решении вопроса данной темы, а также за моральную поддержку!


  • Записки IT специалиста — Форум

  • Серверные операционные системы

  • Ubuntu Server/Debian

  • Ошибка в работе DNS на Ubuntu 16.04

Понравилась статья? Поделить с друзьями:
  • U3fff код ошибки мицубиси
  • U3fff код ошибки веста
  • Ubuntu обнаружены ошибки при проверке диска
  • U3fff код ошибки renault
  • Ubuntu как проверить флешку на ошибки