How do you change the DNS settings on Ubuntu?

There are two ways to modify DNS in Ubuntu: 1. Modifying DNS via command line: Open the terminal, enter the following command:

  sudo nano /etc/resolv.conf

This will open a text editor that allows you to edit the DNS configuration file. In the file, you can see lines similar to the following content:

  nameserver 192.168.1.1

Replace this line with the IP address of the DNS server you want to use, for example:

  nameserver 8.8.8.8

  nameserver 8.8.4.4

Save the file and close the text editor. Your DNS settings will take effect immediately. To change DNS via the network settings interface on Ubuntu, click on the network connection icon on the top menu bar, then select “Network Settings”. In the window that opens, click on the “Connections” tab on the left, then select the network connection you are currently using. In the details of the network connection, locate the “IPv4” or “IPv6” tab, depending on whether you are using IPv4 or IPv6. In the tab, find the “DNS” field, click the toggle button next to “Automatic” to switch it to “Manual” mode. Now you can add, delete, or edit the IP addresses of DNS servers. Click the “+” button to add a new DNS server, then enter the IP address and save the changes. After closing the network settings window, your DNS settings will take effect.

广告
Closing in 10 seconds
bannerAds