Did you find this helpful? Are there any other hosts file tricks you know? Let me know over on Twitter. If you read this far, tweet to the author to show them you care. Tweet a thanks. Learn to code for free. Get started. Forum Donate. Kris Koishigawa. But knowing where it is and how it works can be helpful if: you're having trouble with local development you suspect malware has tampered with the hosts file you want a quick and simple way to block some websites or if you want to set up some helpful shortcuts to internal IP addresses In this article we'll cover what a hosts file is , how to edit it on Windows , and we'll go over some neat tricks you can do with it.
What's a hosts file anyway? For example, here's a line you'll find in many hosts files on Windows, Linux, and macOs: Why hosts files fell out of favor The hosts files system worked well for the early internet, but there were a few major problems.
As you can imagine, hosts files would get complicated, fast. The solution If you're thinking that someone should have just made a central repository to map all IP addresses with all hostnames, that's exactly what happened.
How to edit a hosts file on Windows To edit a hosts file on Windows 10, you'll need to open it as an administrator. To change the file type, click on the dropdown in the bottom right of the Open menu and click on "All Files": You'll see a file named hosts.
Double click on that file to open it. Then, you'll see a hosts file similar to this: Copyright c Microsoft Corp. This file contains the mappings of IP addresses to host names. Each entry should be kept on an individual line. The IP address should be placed in the first column followed by the corresponding host name.
The IP address and the host name should be separated by at least one space. Additionally, comments such as these may be inserted on individual lines or following the machine name denoted by a ' ' symbol. For example: With that out of the way, here are some things you can do with the hosts file.
How to update the hosts file on Windows 10 if you have trouble with localhost If you're doing some local development and are having problems with localhost, you can just remove the comments from your hosts file How to update your hosts file on Windows 10 if you think it's been tampered with Even though hosts files have fallen out of favor with newer systems like DNS, they still work for legacy reasons.
How to use the hosts file on Windows 10 to block websites Don't want friends or family to visit certain websites on your computer? If so, then you can use the hosts file to block websites entirely.
I can't answer for IE since we dont use it. Lol — manas. Anyone interested see here: stackoverflow. Also, this got me and another IT person once, there were lots of blank lines in the window hosts files, and then entries way down below -- we didn't noticed the scroll bar :- Is the hosts file really the hosts file? Kyle Brandt Kyle Brandt Thanks though! Good suggestions all! Good catch, my system was booting off of drive E: and not C: as expected. Turns out that my corporate DNS was being hit before my hosts file.
Good to hear that you have a workaround. But as much as I know the hosts file should always be used first to make dns lookups prior to every entry in your dns server list. Is it possible to deactivate the lookup in the hosts file completely with some dhcp - options? Maybe you can add your corporate DNS Servers as third and fourth entry in your dns server list. Perhaps your web browsers are configured with a proxy server?
Kalle Richter 5 5 silver badges 17 17 bronze badges. Maximus Minimus Maximus Minimus 8, 1 1 gold badge 21 21 silver badges 35 35 bronze badges. Mike Mike 1 1 gold badge 3 3 silver badges 12 12 bronze badges. This fixed it for me. I just added the Users group directly to the hosts file, flushed the cache, and the hosts file was immediately respected again. Like here: Ahmad Ahmad Ahmad Ahmad 21 1 1 bronze badge. My experience has generally been that Windows is fine with tabs in the hosts file.
Has this solution worked for anyone? What should the permissions be right now the file is not read only and all permissions are set to allow for all users? I tried setting to www. I changed the line to Then anything I tried to ping returned Request timed out.
I'm in the middle of a BIND install now to try and fix this, I don't know if that would effect the pings And now I either installed BIND wrong, or my computer is ignoring that too, because it isn't working either Maybe some texteditor inserted odd characters in there UTF8.
JamesRyan JamesRyan 8, 2 2 gold badges 23 23 silver badges 36 36 bronze badges. Yeah, everything in lmhosts. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. User Name Remember Me? XP: Browser ignoring host file. Yes a windows question. I have too many lazy staff members who persist in browsing the internets when they should be working so I am looking to lock down the usual suspects FB etc.
However changing the host file does not block the sites because I believe that the proxy we use stops the host file from being looked at. Hoping it is a nice check box in an obscure preference location, or a simple tweaking of the proxy. Other solutions are welcome to stop the slackers - I proposed clubbing them like baby seals but the owner said that option was not on the table.
Angels bleed from the tainted touch of my caress. Find More Posts by chucker. If I knew how to do that I wouldn't have asked the question!! Because I am tinkering in things that I really shouldn't be touching, it is more along the lines of what can I change without busting the system. I have the power to change anything at store level as long as everything still works fine - Head Office turns a blind eye, or will give no IT support if I screw the pooch.
How about toilet duty for repeat offenders? Is your proxy set up so that in the Connections area of your browser settings, it's routed through a local IP address? It's designed for local addresses, but it suggests that you can put internet addresses there too. In theory, putting them there will stop Firefox routing traffic to those addresses through the proxy.
With any luck, it won't get out of your local network at all. The effect of this is that the page ie Facebook never loads. It's not exactly what you're asking for, but I believe it would work.
0コメント