Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: hosts and lmhosts

14 Apr 2011   #1
colinearpsycho

7 home premium 64-bit
 
 
hosts and lmhosts

if i add an entry into the hosts file, shouldn't it stop me from trying to access that webpage? i'm also wondering, how to lookup the ip address of pages i visit, or servers i connect to so i can prepare similar file configurations to hosts and firewall settings.


My System SpecsSystem Spec
.
14 Apr 2011   #2
pparks1

Windows 7 Ultimate x64
 
 

if you put an entry in a hosts file, the computer will NOT stop you from accessing the webpage, but rather will always use the IP address that you put into the hosts file. It's like writing down a phone number in an address book. If you ALWAYS use your address book, and never use the phone book (DNS), then you will always believe the phone number from your address book is the right number.

As far as looking up pages you visit, go to a command prompt and type, ping Google. And it will respond with an IP address of a google server. However, be advised that many big web services and such have tons and tons of machines that serve up their web pages. So, hard coding a specific server for a site into a hosts file is not always a desirable action.
My System SpecsSystem Spec
15 Apr 2011   #3
colinearpsycho

7 home premium 64-bit
 
 

so lmhosts.sam is a pain in the kilt-covered? I'm confused as to the hosts file (not lmhosts.sam). It seems to me that I should be putting MY IP address in place of 127.0.0.1. I have trouble with wording, and although a lot of information on the net says 127.0.0.1 is the loopback, I am unsure if the new ipv6 implementations have comprimised the integrity of an ipv4 loopback interface. I don't feel hosts is doing it's job tbh...I've read a few tutorials, and they all say the same thing but on this network I don't have to do anything technical in order to have to scratch my head and say, why is the screen glitching, what's the stall...

I am near to say it's 2gb of memory, but it's ddr3 and a 2.8 ghx athlon II x2 220, not top of the line I know, but it shouldn't have trouble running several non graphics intensive programs side by side and after I configured the task scheduler, there was a lot of hang-up; I was trying to think of a way to make a really secure hardware firewall without coding, because I don't know code, and with 3rd party programs. For instance, the idea was to get defender running on a schedule, and anti-virus, to setup windows firewall appropriately, and just dedicate this small form factor machine to that purpose (it didn't meet the specifications for heavy rendering, although it meets the minimum specs, those should be raised!).

that's the story short, and if you can't answer further, cool, thanks for your input. and of course, i was placing similar entries to hosts in restricted sites (like with spybot's hosts integration, and manual entries as I came across ad cookies, or research pages). It just doesn't seem sufficient enough. I'm almost sure it's something called wervault, or werfault? It is one of those stock programs that installed with Windows, I just can't finger the spelling, but the real issue is that just randomly blocking programs that sound funny, isn't working because it's always an issue with another service or program. Although the microsoft websites say a lot, they really don't place much emphasis on detail, except to say this is what the program does in the broadest spectrum. There is no cross reference for, these programs may implement the program wervault or whatever, these may implement it (with or without network connectivity), even again on a broad basis. So it's tough to nail down the system.
My System SpecsSystem Spec
.

15 Apr 2011   #4
WebMattR

W7 Professional x64
 
 

Okay. So, as I've read through this, I'm afraid I've lost track of something somewhere along the line, so I was hoping to start with a simple question, and perhaps the answer to that will help us help you with the original question you asked.

With this whole process you're doing, what exactly is your end goal? Are you trying to block websites, or something different?
My System SpecsSystem Spec
17 Apr 2011   #5
colinearpsycho

7 home premium 64-bit
 
 
...

to prevent redirection to known malware addresses.
i was under the impression that this is the purpose of the hosts file. and that's why it surprised me, that by entering ip's or domains on the list in conjunction with a local loopback point, IE will still allow users to navigate to those addresses. maybe this is a point of insecurity in IE, that it isn't monitoring it's own http redirection functions. and don't let me fool you into think i know the first thing about internet explorer besides knowing how to prompt for cookies.
My System SpecsSystem Spec
17 Apr 2011   #6
logicearth

Windows 10 Pro (x64)
 
 

Alright. I'll put it clearly as possible. The hosts file does not do what you think it does. The hosts file is a low tech version of an DNS. A DNS turns domain names, like google.com, yahoo.com into something a computer understands, IP addresses. That is what a hosts file does, its a DNS a very low tech DNS.
My System SpecsSystem Spec
18 Apr 2011   #7
colinearpsycho

7 home premium 64-bit
 
 

lmhosts is from what i understand, but hosts i guess is supposed to (according to my reading) vary. providing the functionality of not permitting IE or other browsers redirect internet traffic to ip's or domains listed in the file, and instead (and this is where i'm confused) either redirecting them to a loopback point 127.0.0.1, or using the ip address on the file considered the loopback point to prevent redirection to a site, from that ip address.

so

127.0.0.1 doubleclick.net 0.0.0.0

in the hosts file says don't let doubleclick.net from 0.0.0.0 redirect traffice originating from 127.0.0.1

127.0.0.1 is supposed to be the localhost, and that's why i got confused as to whether i should input my ip address instead of 127.0.0.1. i understand what lmhosts does more or less, it registers ip's to websites. there are two troubles i see with it though, one being that dynamically assigned ip's seems to be all the craze so constant updating of that file would be annoying as all heck without a range of generic addresses for a page. and secondly i don't know if lack of having an lmhosts.sam file means that if i did have 128.6.4.32 suchandsuch.net (and that might be correct syntax but assume it were for an lmhosts entry just to suffice as an albeit bad, example), then does lmhosts.sam not tell me via an internet explorer prompt that website is trying to redirect traffic? i guess I should try it out. the problem is i don't have any means of testing it out....nor do I really want to.

to revert, the hosts file preventing traffic redirect doesn't sound like it should work without using my ip address, or without having a loopback point that is listening to web traffic, i.e. another machine for sandboxing or some such. it's like goto statement harmful. i installed a program called hostess, to help manage the hosts file too. and i experimented and placed my ip into the 127 setting, when hostess did her thing of manicuring the hosts file into well name groups and categories, it only renamed some of the entries back to the 127 setting. i'm not sure why, but i also want to associate 127 with doubleclick.net.

does that clarify my issue more?
My System SpecsSystem Spec
18 Apr 2011   #8
WebMattR

W7 Professional x64
 
 

Quote   Quote: Originally Posted by colinearpsycho View Post
to revert, the hosts file preventing traffic redirect doesn't sound like it should work without using my ip address, or without having a loopback point that is listening to web traffic, i.e. another machine for sandboxing or some such. it's like goto statement harmful. i installed a program called hostess, to help manage the hosts file too. and i experimented and placed my ip into the 127 setting, when hostess did her thing of manicuring the hosts file into well name groups and categories, it only renamed some of the entries back to the 127 setting. i'm not sure why, but i also want to associate 127 with doubleclick.net.

does that clarify my issue more?
The hosts file isn't designed to prevent anything. The host file is a very very basic DNS function. Mainly, it just specifies a loop back address. Now, I'm almost afraid to ask, but why would you want to specify that your loopback address points to doubleclick.net? That probably would just break things... not to mention sending you to doubleclick.net.

Personally, I'd say install Antivirus, a Firewall, and just leave the poor host file alone. It really isn't designed to do what you're trying to do, if I'm even understanding it correctly.
My System SpecsSystem Spec
18 Apr 2011   #9
pparks1

Windows 7 Ultimate x64
 
 

What happens with a host file and malware, is that some malware will PUT entries into a hosts file so that your computer goes to whatever site "THEY" want you to go to, versus the legitimate site that DNS would direct you to.
My System SpecsSystem Spec
18 Apr 2011   #10
fseal

Windows 7 x64 Ultimate
 
 

Quote   Quote: Originally Posted by colinearpsycho View Post
so

127.0.0.1 doubleclick.net 0.0.0.0

in the hosts file says don't let doubleclick.net from 0.0.0.0 redirect traffice originating from 127.0.0.1
1) lmhosts is for windows networking only so forget about that, hosts is for the internet

2) You sort of have it backwards. Your entry above means that when your computer tries to look up the address of "doubleclick.net" it will use 127.0.0.1 instead of the actual address.

So yes you can block sites that way.

OR if you find that for some reason your DNS server is returning bad addresses for say Google you can put in something like

www.google.com 74.125.224.171

And instead of using DNS it will use that known good address for google.

BUT!

If you have a virus or something that is redirecting your lookups locally then the hosts file maynever get used or as mentione above even rewritten in order to cause the redirection...

The hosts file is most useful for two things. Blocking a web site by NAME (not number). or if your DNS is out or bad or some other reason, entering entries by hand...
My System SpecsSystem Spec
Reply

 hosts and lmhosts




Thread Tools




Similar help and support threads
Thread Forum
Hosts file ignored and replaced with hosts.original
Hello. I am trying to use the hosts file. However both pings and web addresses still bypass the hosts file. I noticed that there is another file in the C:\Windows\System32\drivers\etc directory called 'hosts.original'. When ever I delete this file, it reappears seconds later. I have made sure that...
General Discussion
Hosts.txt or hosts.sys
in the drivers/etc folder is: hosts.txt and hosts.sys. I want to edit the hosts file but i dont know is it hosts.txt Or hosts.sys. Oh, theres a file called Hosts without extension on my diffrent pc too. Can you tell me is it safe to edit hosts file as well? The hosts file witout extension...
General Discussion
Hosts file-S??
can the hosts file be changed to, or amended by, another file? IOW can there be a file named xyz that essentially replaces the hosts file, or adds entries to it? Possibly by a registry key or configuration setting? Of course it could by altering library fxns, but by other "simpler" means? ...
System Security
hosts...again...but differed
i put some of the network computers on my hosts list, to try and circumvent some issues and lost internet connectivity. none of the ip addresses are listed as the subnet, default gateway; etc. they were just ip's of other computers that connect to this network at times. why did that happen? is it...
Network & Sharing
HOSTS File - Create a "Edit HOSTS file" Shortcut
How to Create a "Edit HOSTS file" Shortcut in Windows 7 and Vista The HOSTS file is a .txt file used in Vista and Windows 7 to map hostnames to IP addresses. Your computer checks this file first to resolve any network names to its corresponding IP address before it tries to check the Internet....
Tutorials
HOSTS file
I setup a hosts file in windows xp in order to use my website locally using the exact domain name by editing the hosts file by adding the line: 127.0.0.1 www.test.com This should resolve my local ip address for the test.com site and if apache is running, then it should load the website...
Network & Sharing


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 22:38.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App