Skip to content

How to configure DNS in Linux

7 November 2022
Linux

DNS Configuration

  • Domain Name Service translates hostnames to network addresses.
  • Server address is specified by dhcp or in /etc/resolv.conf

    search example.com remote.test
    nameserver 192.168.0.254
    nameserver 192.168.1.254

    There are only two settings one generally needs to remember when creating or modifying resolve.conf: search and nameserver. nameserver is the most important, as it specifies the IP address of a DNS server your system should use. Multiple nameserver lines may be added. Since servers are tried in order, be sure to put the one that is fastest and most likely to be available first.

Example: –

Adding google DNS server’s IP. Open file in vi editor.

# vi /etc/resolv.conf

How to configure DNS in Linux

adding: – nameserver 8.8.8.8

How to configure DNS in Linux

Save & close file.