Configuring DNS NameServer on Linux Cloud Servers

2020-02-05 By Sam 19503 Views linux dns nameserver networking
7 reviews

DNS name servers are used for name resolution from a server in all operating systems. In most Linux Operating systems, these DNS servers are specified in the file /etc/resolv.conf. This file contains one nameserver line which defines the DNS server.

This file can be viewed and the DNS nameservers edited by using the steps given below:

  1. Open the file using any editor.

    # vi /etc/resolv.conf


  2. Add lines for the name servers that need to be used.


    Here the common Google nameservers and have been used.

In modern Linux, this file is indirectly managed by the systemd-resolved service, and in some cases by the network service (by using initscripts or NetworkManager). Hence, manually changed values do not last or will get revoked after a reboot. To resolve this, the resolvconf utility can be installed and used to make the changes permanent. The below steps can be used for this.

  1. Run update before proceeding with the installation.

    # apt-get update


  2. Install resolvconf by executing the below command.

    # apt install resolvconf


  3. Verify the service status.

    # systemctl status resolvconf.service


    If the service is not started, it can be started using the below commands:

    # systemctl start resolvconf.service
    # systemctl enable resolvconf.service
    # systemctl status resolvconf.service


  4. Set up permanent DNS nameservers.

    # vi /etc/resolvconf/resolv.conf.d/head



    Here the common Google nameservers and have been used.

  5. Restart the service.

    # systemctl restart resolvconf.service


Related Tutorials

What do you think about this article?

Rate this article
Need assistance?

Try this guide to receive free bundled services at signup on a new free account.

Sign Up

Your Feedback Is Important

We hope you’ll give the new products and updates a try. If you have an idea for improving our products or want to vote on other user ideas so they get prioritized, please submit your feedback on our Community platform. And if you have any questions, please feel free to ask in the Community or contact our Technical Support team.