How to add Primary and Secondary DNS server – /etc/resolve.conf – Linux

Just finished installed CentOS 5. but it can’t recognize any domain. Finally, found out i haven’t add any domain name server (DNS) in my machine. Below is the steps to add domain name server (DNS) in your machine using /etc/resolve.conf file:-


  • Open file /etc/resolve.conf
  • You should see something like this:-

    search localhost.localdomain

    Add your Primary and Secondary Domain Name server (DNS) ip at the end of the file and it should look like this:-

    search localhost.localdomain
    nameserver 888.888.888.888
    nameserver 888.888.888.999

  • Save the file and exit
  • Done! you just added primary and secondary dns server in your machine.
  • To check if your machine works fine, type ping If it has reply means your machine work well. If it show unknown host then your configuration has something wrong. Check and rectify it.

[tags]dns server, primary dns server, configure dns server, setup dns server, add dns server, add dns server in linux, configure linux dns server, setup linux dns server[/tags]

Share this with your friends:-

4 Responses to “How to add Primary and Secondary DNS server – /etc/resolve.conf – Linux”

  1. ray says:

    I think you mean /etc/resolv.conf

  2. idsinc says:

    Hi Chua..

    The two dns numbers given, are they the primary and secondary dns, resepectively?

    Regarding LAMP, do you know how it compares to Cpanel?

    Thanx again!

  3. chua says:

    hi idsinc, you can use this OpenDNS server IP:

    just point your domain to your static IP at the Domain Control Panel provided by your registrar. It will allow ppl to access your domain.

    if u wanted to install a hosting server, may be you can check out this:-

  4. idsinc says:

    When you Add your Primary and Secondary Domain Name server (DNS) ip at the end of the file , What are those numbers suppose to be? Can you just make up a series of numbers? I don’t know how to do this, so please make up an example.

    If my static IP address is 42.156.331.55, and that is registered with a domain name like, do these values have to be recorded in the server somewhere?

    If my domain name through my ISP is, should that be the name I give the server? I’m trying to build a hosting server, so that may be helpful to know.

    I installed Centos 5.3, and I don’t even have a desktop screen… just a command prompt… should I have installed an extra application from the list, other than SERVER?

    Any information you can give will be most helpful.

Leave a Reply