[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Get windows to use hosts before DNS

Posted on 2001-07-26
16
Medium Priority
?
270 Views
Last Modified: 2008-02-20
How do I make windows look in a local hosts file before it queries DNS without third party add-on software?

Example hosts file (I had to go to dos prompt to get rid of the extension)

127.0.0.1      localhost
208.50.148.12   www.microsoft.com
10.1.2.3       www.foo.com

DNS resolution is set to the ISP's server.

when I type www.foo.com in my browser I see the local server OK. When I type www.microsoft.com I see M$'s server but I want to see EE's server which is the IP address in hosts file.

I can work around it by adding my own DNS server or using addons but that's not the Q. A reg tweak would be cool.


0
Comment
Question by:andyalder
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
  • 4
  • +1
16 Comments
 
LVL 63

Expert Comment

by:SysExpert
ID: 6324050
Here you go. I just need to dig up which node type does what !!

http://www.winguides.com/registry/display.php/739/

I hope this helps !
0
 
LVL 63

Expert Comment

by:SysExpert
ID: 6324075
Here
http://www.mcpmag.com/members/97novdec/col4main.asp

Isn't the internet grand !!

I hope this helps !
0
 
LVL 63

Expert Comment

by:SysExpert
ID: 6324104
0
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 
LVL 63

Expert Comment

by:SysExpert
ID: 6324111
And finally - a better explanation at
http://ctdp.tripod.com/os/windows/wintcp/wtcpname.html
0
 
LVL 56

Author Comment

by:andyalder
ID: 6324125
Look Sys, get your web browser to go to www.experts-exchange.com when you type www.microsoft.com before you comment in this thread again please.
0
 
LVL 56

Author Comment

by:andyalder
ID: 6324453
I am going to delete this question and post it again with exactly the same wording and if some dork that does not know the difference between netbios and DNS f**ks it up again I'll quit EE.

>>Exchange is like a game. Some Experts play the game by providing a large quantity of poor answers.

same goes for comments in my book.

Hope this hepls.
0
 
LVL 41

Accepted Solution

by:
stevenlewis earned 1200 total points
ID: 6324854
Andy, I am running ME here at the office, and I just edited my host file to read
208.50.148.12   www.microsoft.com

I then went to my browser and typed www.microsoft.com and it sent me to EE. (I will now have to edit it and reboot, LOL)
If you have been to M$ then you must clear the dns cache before it will resolve incorrectly.
I did my test on a fresh boot (no prior dns entries or resolution)
What OS are you testing this on?
And of course your hosts file is in c:\windows and just "hosts"? no extension
here is a link
http://www.daltontel.com/~dhack/mcse/tcpnameres.html
and here
http://www.phoneboy.com/faq/0072.html

and here is the definitive answer from M$
http://support.microsoft.com/support/kb/articles/Q172/2/18.asp
NOTE: In the context of this article, the term "client" does not necessarily refer to a workstation. A Windows NT server will take the role of client when it requires access to resources that require host name resolution.

Host name resolution generally uses the following sequence:


The client checks to see if the name queried is its own.


The client then searches a local Hosts file, a list of IP address and names stored on the local computer.

NOTE: The Hosts file location depends on the operating system:
   Windows NT                  %Systemroot%\System32\Drivers\Etc
   Windows 95                  <drive>\<Windows folder>
   Windows for Workgroups      <drive>\<Windows folder>
   Windows 3.1                 <drive>\<Windows folder>
   MS-Client 3.0               <Boot volume>\Net
   Lan Manager 2.2c Client     <Boot volume>\Net
Where %Systemroot% is the folder in which Windows NT is installed, <drive> is the drive on which the OS is installed, and <boot volume> refers to a boot floppy disk or drive C.

A sample hosts file, Hosts.sam, is installed with the TCP/IP protocol showing the proper format.


Domain Name System (DNS) servers are queried.


If the name is still not resolved, NetBIOS name resolution sequence is used as a backup. This order can be changed by configuring the NetBIOS node type of the client.


The Windows client will try each of these methods until it either successfully resolves the name or exhausts these methods. Windows NT, Windows 95, and Windows for Workgroups clients using Microsoft TCP/IP 3.11b follow this sequence. Lan Manager 2.2c or Microsoft Client 3.0 clients will not use NetBIOS name resolution as a backup
0
 
LVL 41

Expert Comment

by:stevenlewis
ID: 6324886
edit yours again, reboot, and see if it works for you
0
 
LVL 56

Author Comment

by:andyalder
ID: 6324947
It is nearly midnight, I'll try again tomorrow. Haven't tried ME, but it don't work with 95, 98 or nt4, sure you haven't got anything extra added?
0
 
LVL 41

Expert Comment

by:stevenlewis
ID: 6324975
positive, standard install
and again I point out the link from M$ in my above post
G'nite Andy
Steve
0
 
LVL 56

Author Comment

by:andyalder
ID: 6325020
>I did my test on a fresh boot (no prior dns entries or resolution)

Ah, "no prior DNS entries" but I have dns entry for the ISP's resolver in my config as I say in the question. Can you try again with a resolver configured.

0
 
LVL 41

Expert Comment

by:stevenlewis
ID: 6325051
I will when I get home, as I have ip config info on my machine (dns entries)
0
 
LVL 41

Expert Comment

by:stevenlewis
ID: 6325398
OK Andy, I tried it at home (w98 se networked to my main, which is using ICS, so I have dns entries on my NIC. Two of them, one my main machine 192.168.0.1, and one is my isp. I made the entry to the hosts file, and it resolved it to here.
208.50.148.12   www.microsoft.com

so the question is why isn't your machine resolving from the hosts file first.
1.) you have the reg entries as mentioned in Sys's posts
2.) the hosts file is not configured correctly, so forgive me if I review the hosts file
must be named hosts, no extension (not .txt or .sam) just "hosts"
must be in c:\windows (if 9x) or %systemroot%\system32 (if NT/2000)
can not have the # pound sign in front of the entries
there must be at least one space between the ip address and the host name
Steve
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6326134
probably I may have not read some essential phrases in the long dialog above, but my  %systemroot%\system32\drivers\etc\hosts works if in the TCP/IP settings WINS tab the LMHOSTS query is enabled.
If you also need NetBIOS ther is a NetBIOS over TCP/IP checkbox too.
I never reboot when changing my hosts file (even this is a must for any change on M$ systems :), and also have never noticed any problems with cached mappings.

I also know that the TCP/IP nodetype should be set to hybrid (dezimal 7?) in the registry. You'll see the setting with the  ipconfig -all  command.

BTW, I do not "play the game by providing a large quantity of poor answers", I'm just wondering ...
0
 
LVL 56

Author Comment

by:andyalder
ID: 6326218
My apologies to sysexpert for being rude but it was nothing to do with netbios.
Following Steve's 2nd and 3rd URL led me to Q139270 and I see someone changed the registry keys to force DNS first.
0
 
LVL 41

Expert Comment

by:stevenlewis
ID: 6326238
Andy Glad we were able to get this all staighten out
Steve
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For many of us, the  holiday season kindles the natural urge to give back to our friends, family members and communities. While it's easy for friends to notice the impact of such deeds, understanding the contributions of businesses and enterprises i…
WARNING:   If you follow the instructions here, you will wipe out your VTP and VLAN configurations.  Make sure you have backed up your switch!!! I recently had some issues with a few low-end Cisco routers (RV325) and I opened a case with Cisco TA…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question