Here recently I was setting up a ubuntu 20.04 server and was experiencing network lag when first connecting to a domain (i.e.
sudo apt update). To resolve this, I set out to update the DNS IPs on the server. However, when I went to configure it, I found that once again the network manager had changed again (or something I’m not sure). Searching the interwebs returned back many results, but none seemed to be what the default ubuntu 20.04 server was using. After some search I found this question on askubuntu which used netplan.
Updating DNS Using NetPlan
NetPlan stores all network configurations at
/etc/netplan/. There can be a number of files already here, or none. For me, I already had one configuration file located here. The file name is
00-installer-config.yaml and it looks like this.
network: ethernets: eno1: dhcp4: true version: 2
To update what DNS servers the
eno1 interface uses, we simply need to add the nameservers property to it. To do this, we need to update the file like so:
network: ethernets: eno1: dhcp4: true nameservers: addresses: [126.96.36.199,188.8.131.52] version: 2
After you saved and closed the configuration file, you need need to apply the network plan. That is done by running the following command as sudo:
You will most likely have to restart your server, but afterwards, it will be configured to use the specified DNS IPs.