Link to home
Start Free TrialLog in
Avatar of Member_2_231077
Member_2_231077

asked on

Get windows to use hosts before DNS

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.


Avatar of SysExpert
SysExpert
Flag of Israel image

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 !
Here
http://www.mcpmag.com/members/97novdec/col4main.asp

Isn't the internet grand !!

I hope this helps !
Avatar of Member_2_231077
Member_2_231077

ASKER

Look Sys, get your web browser to go to https://www.experts-exchange.com when you type www.microsoft.com before you comment in this thread again please.
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.
ASKER CERTIFIED SOLUTION
Avatar of stevenlewis
stevenlewis

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
edit yours again, reboot, and see if it works for you
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?
positive, standard install
and again I point out the link from M$ in my above post
G'nite Andy
Steve
>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.

I will when I get home, as I have ip config info on my machine (dns entries)
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
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 ...
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.
Andy Glad we were able to get this all staighten out
Steve