Windows Server 2003
1752762 Members
5011 Online
108789 Solutions
New Discussion юеВ

Re: use /etc/hosts file instead DNS

 
amin Tabarak
Advisor

use /etc/hosts file instead DNS

Hi all,

I have a W2k3 boxe ,i want to use /etc/hosts instead DNS IE i want nslookup command point to /etc/hosts first to resolve the ip.is there a way to configure this

Thanks for your support,
Amine
8 REPLIES 8
WFHC-WI
Honored Contributor

Re: use /etc/hosts file instead DNS

hi amine,

You can set the default server for nslookup requests by entering:

NSLOOKUP
SERVER


In this case you want to use the local machine name.

good luck, if you appreciate the answers we appreciate the points :)
Rune J. Winje
Honored Contributor

Re: use /etc/hosts file instead DNS

Hi,
ref http://technet.microsoft.com/en-us/library/bb727005.aspx

The host name resolution process will first query the local DNS client cache. Then it will look in the Hosts file and lastly query DNS if none of the previous provided a name resolution.

So, the only thing you need to do to make W2K3 use the Hosts file is to enter hostnames and corresponding IP-addresses.

In case the local DNS cache has already resolved a name that you want it to look into the Hosts file for instead - you should do a "ipconfig /flushdns" command first. This will clear the local DNS client cache and therefore it will continue to check the Hosts file and secondly DNS.

Using "ipconfig /flushdns" is always a good idea when testing name resolution to not get fooled by results from the local cache.



Cheers,
Rune
Michal Kapalka (mikap)
Honored Contributor

Re: use /etc/hosts file instead DNS

hi,

I have a W2k3 boxe ,i want to use /etc/hosts instead DNS IE i want nslookup command point to /etc/hosts first to resolve the ip.is there a way to configure this

/etc/hosts is in Unix / Linux enviroments, in the Windows the hosts file is located in :

C:\WINDOWS\system32\drivers\etc

mikap

amin Tabarak
Advisor

Re: use /etc/hosts file instead DNS

even with this command (flushdns), and /etc/hosts correctly field , i still have the problem.It seems that nslookup can't read from hosts file !
Anshumali
Esteemed Contributor

Re: use /etc/hosts file instead DNS

As Mikap said,
What OS you are actually using? /etc/hosts is *nix style local name lookup not Windows.
Would you mind putting an entry into C:\WINDOWS\system32\drivers\etc and test again?
Does ping from command prompt works at all. Post the nslookup output as well...
Dreams are not which you see while sleeping, Dreams are which doesnt allow you to sleep while you are chasing for them!!
amin Tabarak
Advisor

Re: use /etc/hosts file instead DNS


C:\Documents and Settings\>nslookup trafprod
Server: xxx.???.net.ma
Address: xx.xx.xx.xx

*** xxx.???.net.ma can't find tarfprod: Non-existent domain

C:\Documents and Settings\>

and my /etc/hosts has the fellowing entry with the correct ip and hostname
xx.xx.xx.xx tarfprod
amin Tabarak
Advisor

Re: use /etc/hosts file instead DNS

OS is w2k3 ,and the ping works with both ip and hostname
WFHC-WI
Honored Contributor

Re: use /etc/hosts file instead DNS

Hi Amine,

Check the properties of your server's network connection:

Network Connection > Properties
Internet Protocol (TCP/IP) > Properties
Advanced...
DNS tab

I think you want to set "Append these DNS suffixes (in order):"
Make sure the domain for trafprod is present in the list.