About nixCraft

Topics

Linux: How to setup as DNS client / name server IP address

Posted by Vivek Gite [Last updated: October 8, 2007]

Many new Linux user finds it difficult to setup / modify new name server address (NS1 / NS2).

Local name resolution is done via /etc/hosts file. If you have small network then use /etc/hosts file. DNS (domain name service is accountable for associating domain names with ip address, for example domain yahoo.com is easy to remember than IP address 202.66.66.12) provides better name resolution. To configure Linux as DNS client you need to edit or modify /etc/resolv.conf file. This file defines which name servers to use. You want to setup linux to browse net or run network services like www or smtp; then you need to point out to correct ISP DNS servers:

Setup DNS Name resolution

Steps to configure Linux as DNS client, first login as a root user (use su command):

Step # 1: Open /etc/resolv.conf file:

# vi /etc/resolv.conf

Step #2: Add your ISP nameserver as follows:

search isp.com
nameserver 202.54.1.110
nameserver 202.54.1.112
nameserver 202.54.1.115

Note Max. three nameserver can be used/defined at a time.

Step # 3:Test setup nslookup or dig command:

$ dig www.nixcraft.com
$ nslookup www.nixcraft.com

See also:

E-mail this to a Friend    Printable Version

You may also be interested in other helpful articles:

Discussion on This Article:

  1. Anonymous Says:

    Very precise brief & 100% helpful

    Thanks!!

  2. Anonymous Says:

    This is quite useful when you have DSL or dial up connection and would like to setup dns quickly under Linux. Or even when you can’t browse site on net using domain name but you can browse them (ping them) using the ip-address. This solved my problem as well as Temporary failure in name resolution (which can be caused by ssh, telnet or mail client etc) To browse Internet one need to configure the DNS properly. Thanks for this tiny post.

  3. /etc/resolve.conf or resolv.conf File Example Says:

    [...] For more information see How to Setup Linux as DNS client. [...]

  4. unamed Says:

    Thnx helped me :)

  5. sathish Says:

    hi;

    Im having problem with DNS where it unable to lookup the dns that i have setupd. i have configured my hosts file and resolve.conf but stil not solving my problem. i have statis dns ip from ISP and currently using fedora8. any1 having problem with dns with fc8. i cant surf the internet.it takes long time to resolve suspect that it getting dns from my router. where it not resolving it from what i have edited in the machine. request is tooo slow. anything that could help to solve? need help. i have checked all my setting everything is fine.

  6. Ali durrani Says:

    I need Dhcp ip router in Fc8
    anyone here experience of that?

  7. ganesh Says:

    Hi,
    I’ve setup the internet connection through PPP dial up and able to get the public IP assigned to me. Also I’ve configured the DNS server address in the /etc/resolv.conf file.
    The problem is, I’m able to ping to my ISP’s IP and also to any public IP addresses, but not to any domain names.
    ping http://www.google.com, always fails saying unknown host, but at the same time nslookup and dig work fine(able to resove IP from domain name).
    What may be the problem?, please do help, Thanks in advance,

    –Ganesh

  8. vivek Says:

    try ping google.com

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Tags: , , , , , ,

Copyright © 2004-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Powered by Open source software.