Ubuntu - etc - resolv.conf - Recreating /etc/resolv.conf

Create a world-readable (permission 644) resolv.conf and add some nameservers to it.

For Example:

/etc/resolv.conf
# Quad9.
nameserver 9.9.9.9
nameserver 2620:fe::fe
nameserver 149.112.112.112
 
# Localhost.
nameserver 127.0.0.1
nameserver ::1

You generally don’t need to restart any network management services for the changes to take effect.

However, some system services or programs may have entered a failed state while DNS resolution was disabled.

Do a quick reboot to kick-start them unless you want to manually double-check that all running services and programs have recovered.

You may want to configure additional parameters for the resolv.conf file. See the man 5 resolv.conf manual for details on other domain resolution configuration options.