hosts file
#1
I run a personal web page mainly for private use of file transfers, as such I hope I am not pointing out the blatantly obvious to you Web Admins but I'd like to mention the 'hosts' file on every local computer which can be very handy.

Many people know a little about DNS and web address translation, this all happens transparently in the background, a human readable web address gets converted  into an IP address that the computer understands .

The hosts file is your local DNS translation file which generally is looked at by computers before an address is sent to a DNS for conversion.

The hosts file is  located as follows;
  • Linux /etc/hosts
  • Windows C:\Windows\system32\drivers\etc\hosts
  • Mac - not sure but a web search would find it.

This is an ordinary text file where you can set an alias to any IP address
eg   kx   <numbered IP address>

Enter kx in the browser it goes straight to the konnexu.com site

This file can be used  to block sites, for example, the following entry would block facebook

127.0.0.1     www.facebook.com

As 127.0.0.1 is the local machine address directing www.facebook.com to that address effectively dumps it.

Most computer setups the default order is to check the hosts file before Name Servers so can be much quicker too for regularly used domains, but of course, you have to know the actual IP address.

Just a reminder though, this only works on the computer where the hosts file is edited, does not affect other computers on the home network.  May need a reboot for changes to take place plus I think windows configuration has the hosts file as the first search option.

Geffers
Reply
#2
Thank you, Geffers for your added information.   I'm familiar with namesavers as that gets set during the domain process pointing to the server.  Beyond setting up the domain, I hadn't really thought about the functions afterward, though I've known you can put in an IP address to bring up a website.  Thanks for sharing your detail!
Reply
#3
Great post! For a newer Mac, it's located at /private/etc/hosts . I was lucky I had a friend, Ric - the same Ric who is my partner in BryZar Web Services, who helped me fix my hosts file when I messed up the first time I tried changing it.

A good thing with the hosts file is it can help if your DNS is taking a long time to propagate. When hosting with my first host, propagation took a very long time. So, in order to see my sites I would edit the hosts file (IIRC) but the first time I did it, not sure what I did but it messed up everything lol.
Reply
#4
(10-24-2024, 09:04 AM)Donna_Kx Wrote: Great post! For a newer Mac, it's located at /private/etc/hosts . I was lucky I had a friend, Ric - the same Ric who is my partner in BryZar Web Services, who helped me fix my hosts file when I messed up the first time I tried changing it.

A good thing with the hosts file is it can help if your DNS is taking a long time to propagate. When hosting with my first host, propagation took a very long time. So, in order to see my sites I would edit the hosts file (IIRC) but the first time I did it, not sure what I did but it messed up everything lol.



Easy done when fiddling with config files.  Quite often one resolves an issue then wonders what whas actually wrong with it in the first place.
Reply


Forum Jump: