Close Menu
  • Home
  • Questions
Facebook X (Twitter) Instagram
LinuxTutorials.netLinuxTutorials.net
  • Home
  • Debian
  • Ubuntu
  • CentOS
    • Commands
  • Questions
LinuxTutorials.netLinuxTutorials.net
Debian

How to make permanent DNS changes to resolv.conf file on Ubuntu

May 14, 2019Updated:August 14, 2022No Comments
resolv.conf output

DNS system is the networking service responsible with mapping IP Addresses to names or vice-versa, making easy for humans to identify hosts, servers or other equipment on a network based on their names.

On Ubuntu, the /etc/resolv.conf file is responsible with resolving system-wide domain name mapping by sending DNS queries to the nameservers IP Addresses.

The major disadvantage of resolv.conf file is that its content gets overwritten by network interface hook scripts every time the system reboots or the state of the network changes, making difficult to generate a permanent list of nameservers and domains that can be used all the time.

One of the tricks that you can use to fool down and avoid using resolv.conf nameservers list is to add DNS IP entries in /etc/network/interfaces file on the appropriate Network Interface Card as described in this article.

In order to permanently implement DNS changes to resolv.conf file on Ubuntu, you need to manually edit resolvconf utility base file located on /etc/resolvconf/resolv.conf.d/ system path and add your custom nameservers IP values as presented further on this short guide.

If your Debian-based distribution don’t ship with resolvconf utility by default, install the resolvconf package by issuing the following command, then continue with the below steps:

sudo apt-get install resolvconf

1. First, open resolvconf base file for editing with a text editor with root privileges by issuing the following command:

sudo nano /etc/resolvconf/resolv.conf.d/base

2. By default this file should be blank, so start adding your custom DNS resolvers IP Addresses or other DNS options. Use the below file excerpt as guidance:

nameserver 192.168.1.1
nameserver 8.8.8.8
nameserver 8.8.4.4
search server.lan server1.lan
options rotate

Replace the nameserver IP values and search statement to match your own DNS entries and domains. The last statement, options rotate, forces the resolver to distribute the load to the entire nameservers list in a round-robin fashion (first, second, third in a loop) rather than using the first nameserver every time.

3. After you have populated the file with your appropriate DNS entries , save and close it, then restart you network or reboot the system in order to reflect changes.

sudo reboot

To assure that the DNS changes applied, get the output of the resolv.conf file using cat command:

cat /etc/resolv.conf

resolv.conf output

resolv.conf output

That’s it! Now your resolv.conf file should be populated with the same content as /etc/resolvconf/resolv.conf.d/base file and the DNS changes should be made permanent.

DNS nameserver network resolv.conf Ubuntu
Share. Facebook Twitter Tumblr Email Telegram
Previous ArticleInstall LAMP (Apache-Php-MySQL) in Ubuntu 19.04
Next Article Configure Permanent Static IP Address and Alias Interfaces on Debian-based Systems

Related Posts

Ubuntu

Download and Install Packet Tracer 8.2.2 on Ubuntu (Linux)

May 31, 2024
Ubuntu

How to Install PHPMyAdmin latest version 5.2.0 on Ubuntu 22.04 (LEMP Stack)

September 13, 2022
Ubuntu

Create New User with sudo Privileges on Ubuntu 22.04/Debian

September 12, 2022
Subscribe
Notify of
guest

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Ubuntu Server 24.04 Image for VirtualBox (Download & Import)

March 14, 2025

Download and Install Packet Tracer 8.2.2 on Ubuntu (Linux)

May 31, 2024

How to Install PHPMyAdmin latest version 5.2.0 on Ubuntu 22.04 (LEMP Stack)

September 13, 2022

Create New User with sudo Privileges on Ubuntu 22.04/Debian

September 12, 2022
Facebook X (Twitter) Instagram Pinterest
  • Questions
© 2025 LinuxTutorials.net

Type above and press Enter to search. Press Esc to cancel.

wpDiscuz