Tag Archives: nameserver setup in debian

How to configure nameserver in Linux

Beginners guide on how to configure nameserver in Red Hat, CentOs, Fedora, Debian, Ubuntu or Suse Linux to resolve DNS queries.

Configure nameserver in Linux

Nameserver is the DNS server to which your machine query for name resolutions.  This is pretty much important on servers facing the Internet or having an active internet connection or if your system is part of an organization where the internal domain name system is implemented for IT Infra. In this article, we will walk you through how to set up nameserver in your Linux machine

What is nameserver?

Its server which response to the queries normally domain name resolution. It’s like a phone directory, where you query name and you get phone number. Nameserver receives hostname or domain name in the query and responds back with IP address.

How to setup nameserver in Red Hat?

You  need to open file /etc/resolv.conf in a text editor like vi or nano and add your name server IP in the below format.

nameserver X.X.X.X

For example :

root@kerneltalks # cat /etc/reolv.conf
nameserver 10.10.2.56

You can use the same above same method to configure nameserver in CentOS, Debian, Fedora.

How to setup nameserver in Ubuntu?

Addition to /etc/resolv.conf file, in ubuntu, you can edit file /etc/network/interfaces with the same above said information. The format remains the same.

root@kerneltalks # cat /etc/network/interfaces
nameserver 10.10.2.56

How to configure nameserver in Suse Linux?

If you have access to Suse desktop environment i.e. GUI then you can go to YaST network settings. Navigate to ‘Hostname/DNS‘. Like below :

Suse DNS settings

Here you will be able to add name servers and click Ok to save.

Alternatively, /etc/resolv.conf is way out from command line.