返回 首页

A Desktop-Agnostic Way to Change DNS Server


Editing '/etc/parse.conf' is not recommended any more because the content will be reset after restart.


Open a terminal window and go to the Network Manager connections profile directory.

cd /etc/NetworkManager/system-connections/

Then list connection names available on your system.

ls

Screenshot_select-area_20230629161158.png

As you can see, I have several connections on my system, one of which is wired connection. Some are wireless connections and one is VPN connection. Because my desktop computer is connected to my router via an Ethernet cable, so I need to edit the wired connection profile with the nano command line text editor.

sudo nano 'Wired connection 1'

If your computer is connected via Wi-fi, then you need to edit the wireless connection profile. In this file, find the [ipv4] configurations. By default, it should look like this:

[ipv4]
dns-search=
method=auto

To make your system use 8.8.8.8, change the configurations to the following.

[ipv4]
dns=8.8.8.8;
dns-search=
ignore-auto-dns=true
method=auto

To save the file in Nano text editor, press Ctrl+O, then press Enter to confirm. Press Ctrl+X to exit. Then restart Network Manager for the changes to take effect.

sudo systemctl restart NetworkManager You can now check your current DNS server by running the following command:

systemd-resolve --status

Sample output:

Link 2 (enp5s0)
Current Scopes: DNS
LLMNR setting: yes
MulticastDNS setting: no
DNSSEC setting: no
DNSSEC supported: no
DNS Servers: 8.8.8.8

via: https://www.linuxbabe.com/ubuntu/ubuntu-stubby-dns-over-tls


登录