Edit DNS Configuration Files

Q. How do I edit dns configuration file to add my ISPs nameservers?

A. You need to edit /etc/resolv.conf file to set nameserver. Name server IP address Internet address (in dot notation) of a name server that the resolver should query. Up to 3 name servers may be listed, one per keyword. If there are multiple servers, the resolver library queries them in the order listed. If no nameserver entries are present, the default is to use the name server on the local machine.

ADVERTISEMENTS

Edit /etc/resolv.conf using a text editor such as vi or nano or gedit:
# vi /etc/resolv.conf
Appnd namesever as follows:
nameserver 4.2.2.1
nameserver 4.2.2.2
nameserver 4.2.2.3

Save and close the file. The algorithm used is to try a name server, and if the query times out, try the next, until out of name servers, then repeat trying all the name servers until a maximum number of retries are made.

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
3 comments… add one
  • ndjock-abanda arthur Mar 5, 2009 @ 13:44

    this algorithm implements the recursive mode, how an DNS should work!
    but is there a possibility to implement a non-recursive mode for the DNS ?

  • ashish Feb 26, 2010 @ 10:01

    hello sir
    plz tell me
    i have one computer and i have to configure dns server so how to configure dns server in linux.

    • Salim Jan 2, 2015 @ 9:44

      To create duplicate ip
      #ifconfig eth0:1 netmask

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.