Correção do DNS

Algumas vezes os servidores Ubuntu 18.04 podem não ser capazes de resolver nomes corretamente. Normalmente esse problema está atrelado ao resolv.conf que está incorreto. Para resolver esse problema de forma permanente siga os passos descritos.


Remover o link simbólico atrelando ao arquivo stub.

cd /etc && rm /etc/resolv.conf && ln -s /run/systemd/resolve/resolv.conf


Após isso edite o arquivo resolved.conf.

vim /etc/systemd/resolved.conf


Edite o campo de DNS. Abaixo segue exemplo do arquivo editado:

# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See resolved.conf(5) for details

[Resolve]
DNS=8.8.8.8
#FallbackDNS=
#Domains=
#LLMNR=no
#MulticastDNS=no
#DNSSEC=no
#Cache=yes
#DNSStubListener=yes


Feita a edição reiniciei o serviço systemd-resolved.

service systemd-resolved restart