EDITED:
I modified my netplan settings but it still does not work.
Ubuntu 20.04
cat /etc/netplan/01-network-manager-all.yaml :
# Let NetworkManager manage all devices on this system
network: version: 2 renderer: NetworkManager ethernets: wlp2s0: dhcp4: false addresses: [192.168.1.128/24] gateway4: 192.168.1.254 nameservers: addresses: [1.1.1.1, 1.0.0.1] 7 2 Answers
First find your connection name you want to change and note the name of it:
nmcli connectionThen use nmcli to change the DNS settings:
nmcli connection modify <interface name> ipv4.dns "<DNS Server>,<DNS Server>"Check your interface to ensure that it has been updated correctly:
nmcli connection show <interface name> From the terminal, open up
/etc/netplan/01-network-manager-all.yaml, I prefer to use nano:# nano /etc/netplan/01-network-manager-all.yaml. (The file may be named differently, if01-network-manager-all.yamldoesn't exist usels /etc/netplanto see what the filename is.)Find the part that has
nameserversand addresses:
nameservers: addresses: [8.8.8.8, 8.8.4.4]You can add any number of nameservers there, just separate them with commas.
When you're done making changes, save the file and run
# netplan apply.(Optional) To confirm that your changes were made, run
$ systemd-resolve --status | grep 'DNS Servers' -A2. The nameservers you selected should be displayed.