Author Topic: Questions regarding the "hosts" file  (Read 3271 times)

Offline kimmer

  • Administrator
  • TS Addict
  • *****
  • Posts: 9086
    • View Profile
Questions regarding the "hosts" file
« on: February 28, 2007, 12:05:39 PM »
What is a "hosts" file? Where is it? Is it safe to manually edit it?

That's it unless you want to know why I am considering editing my "hosts" file. wink.gif

Offline Xairbusdriver

  • Administrator
  • TS Addict
  • *****
  • Posts: 26388
  • 27" iMac (mid-17), Big Sur, Mac mini, Catalina
    • View Profile
    • Mid-South Weather
Questions regarding the "hosts" file
« Reply #1 on: February 28, 2007, 03:52:18 PM »
I think it's basically a shortcut to the normal DNS. Instead of looking 'out there' the computer looks first at the Hosts file for the actual address of a site or another machine on the web/LAN.

No problem editing them at all, although it's been a while since I did. I'd suggest making a copy of the one you now have, just in case you mess up the edited one, of course. Any text editor should work fine, stay away from a word processor or just make sure it can save a pure text file ( no suffix needed ).

Many places/forums share Hosts files from different people, they'll work on any computer that can use them. People spend time creating sets of sites that they like and upload them to those that might also like them. Actually, I think you can also add sites/addresses that you don't want anyone to visit ( like a child? ).
THERE ARE TWO TYPES OF COUNTRIES
Those that use metric = #1 Measurement system
And the United States = The Banana system
CAUTION! Childhood vaccinations cause adults! :yes:

Offline kelly

  • TS Addict
  • *****
  • Posts: 17035
    • View Profile
    • http://
Questions regarding the "hosts" file
« Reply #2 on: February 28, 2007, 06:17:06 PM »
kelly
Veteran SuperUser

Offline kimmer

  • Administrator
  • TS Addict
  • *****
  • Posts: 9086
    • View Profile
Questions regarding the "hosts" file
« Reply #3 on: February 28, 2007, 08:13:56 PM »
Thanks bunches ABD and kelly. I learned something new today. I'm gonna leave it be ... especially since I can't seem to find it on my machine. huh.gif

Offline kelly

  • TS Addict
  • *****
  • Posts: 17035
    • View Profile
    • http://
Questions regarding the "hosts" file
« Reply #4 on: February 28, 2007, 08:41:37 PM »
Well it's invisible I believe kimmer. smile.gif

http://en.wikipedia.org/wiki/Hosts_file

Maybe you shouldn't play with it. smile.gif
kelly
Veteran SuperUser

Offline kps

  • TS Addict
  • *****
  • Posts: 1693
    • View Profile
    • http://
Questions regarding the "hosts" file
« Reply #5 on: February 28, 2007, 08:46:57 PM »
it's in /etc

Finder...GO...Go to folder...

type in: /etc

press enter

to edit it...if you change your mind...you may have to be root.

but you can double-click it and read it in TextEdit.

Mine looks like this:

CODE
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1   localhost
255.255.255.255   broadcasthost
::1          localhost

Offline kimmer

  • Administrator
  • TS Addict
  • *****
  • Posts: 9086
    • View Profile
Questions regarding the "hosts" file
« Reply #6 on: February 28, 2007, 10:26:08 PM »
kps, thanks. I may find it and make a copy and open it just to see it with my eyes.

kelly, I think it's invisible for good reason. From what I heard in that broadcast I could make a mess of things if I edited willy-nilly. I'll just wait for the DNS servers to catch up with the one boards move. I don't have any pressing "admin" questions anyhow. wink.gif

Offline Xairbusdriver

  • Administrator
  • TS Addict
  • *****
  • Posts: 26388
  • 27" iMac (mid-17), Big Sur, Mac mini, Catalina
    • View Profile
    • Mid-South Weather
Questions regarding the "hosts" file
« Reply #7 on: March 01, 2007, 09:26:29 AM »
I think with the development of better ad-blocking software and the increased speeds for many to access the net, need for these host files has diminished. Seems they tended to become used more for stopping access to more sites than speed it up for a few.
THERE ARE TWO TYPES OF COUNTRIES
Those that use metric = #1 Measurement system
And the United States = The Banana system
CAUTION! Childhood vaccinations cause adults! :yes:

Offline tacit

  • TS Addict
  • *****
  • Posts: 1628
    • View Profile
    • http://www.xeromag.com/
Questions regarding the "hosts" file
« Reply #8 on: March 01, 2007, 12:36:42 PM »
QUOTE(kimmer @ Mar 1 2007, 02:13 AM) [snapback]120524[/snapback]
Thanks bunches ABD and kelly. I learned something new today. I'm gonna leave it be ... especially since I can't seem to find it on my machine. huh.gif


As others have already said, it lives in /etc.

It's just a simple text file; you can edit it easily with any text editor. If you start putting all kinds of things in there, you may interfere with your ability to surf the Web, but if you do, it's no big deal; you can always just go back and remove any changes you make if you screw something up.

Playing with the hosts file can be a good way to learn about how the Internet works. The hosts file is just a directory of names and IP addresses: "this name means this IP address, that name means that IP address." It's straightforward and painless to edit, and easy to undo any mistakes you make.

When you deal with IP addresses, there are a couple of addresses that are "special." The one that you should learn is 127.0.0.1, which means "this computer." If you set something's IP address to 127.0.0.1 in the hosts file, that means your computer will only look on itself to find that Web site, and will not look on the Internet. That is why you can block ads from being seen by setting the advertiser's address to 127.0.0.1 in the hosts file. The computer will say "Hmm, I'm looking for a banner ad on doubleclick.net. Let's see. Doubleclick.net is 127.0.0.1. Let me look on this computer...nope, can't find it, so I just won't show that banner, and I'll move on."
A whole lot about me: www.xeromag.com/franklin.html

Offline Xairbusdriver

  • Administrator
  • TS Addict
  • *****
  • Posts: 26388
  • 27" iMac (mid-17), Big Sur, Mac mini, Catalina
    • View Profile
    • Mid-South Weather
Questions regarding the "hosts" file
« Reply #9 on: March 01, 2007, 02:05:02 PM »
QUOTE
The computer will say "Hmm, I'm looking for a banner ad on doubleclick.net. Let's see. Doubleclick.net is 127.0.0.1. Let me look on this computer...nope, can't find it, so I just won't show that banner, and I'll move on."
Can I make the computer be quiet by using "0.0.0.0" or even "0"? tongue.gif laugh.gif
THERE ARE TWO TYPES OF COUNTRIES
Those that use metric = #1 Measurement system
And the United States = The Banana system
CAUTION! Childhood vaccinations cause adults! :yes:

Offline tacit

  • TS Addict
  • *****
  • Posts: 1628
    • View Profile
    • http://www.xeromag.com/
Questions regarding the "hosts" file
« Reply #10 on: March 01, 2007, 07:43:54 PM »
QUOTE(Xairbusdriver @ Mar 1 2007, 08:05 PM) [snapback]120581[/snapback]
Can I make the computer be quiet by using "0.0.0.0" or even "0"? tongue.gif laugh.gif


Yep. Any non-routeable IP address will do. I generally don't use 0.0.0.0, because it's reserved for the "default network route," and I have heard apocryphally that it can cause problems with some routers, though I don't know if that's actually the case or not.
A whole lot about me: www.xeromag.com/franklin.html

Offline kimmer

  • Administrator
  • TS Addict
  • *****
  • Posts: 9086
    • View Profile
Questions regarding the "hosts" file
« Reply #11 on: March 01, 2007, 07:53:34 PM »
QUOTE(tacit @ Mar 1 2007, 10:36 AM) [snapback]120571[/snapback]
When you deal with IP addresses, there are a couple of addresses that are "special." The one that you should learn is 127.0.0.1, which means "this computer."
Yes, this I knew. Yeah for me. I've got one thing down. LOL!
QUOTE
If you set something's IP address to 127.0.0.1 in the hosts file, that means your computer will only look on itself to find that Web site, and will not look on the Internet. That is why you can block ads from being seen by setting the advertiser's address to 127.0.0.1 in the hosts file. The computer will say "Hmm, I'm looking for a banner ad on doubleclick.net. Let's see. Doubleclick.net is 127.0.0.1. Let me look on this computer...nope, can't find it, so I just won't show that banner, and I'll move on."

 jawdrop.gif  So I can actually block - totally block certain very annoying advertisers? Now this sounds interesting. clap.gif  I may yet have to try this out. Just for kicks. Yes, playing with things is a good way to learn.

Today I learned a small bit about "bash" and "cpanel" and "scripts" and my head is spinning from it all.

Thanks for the good lessons.

Offline tacit

  • TS Addict
  • *****
  • Posts: 1628
    • View Profile
    • http://www.xeromag.com/
Questions regarding the "hosts" file
« Reply #12 on: March 03, 2007, 02:40:17 PM »
QUOTE(kimmer @ Mar 2 2007, 01:53 AM) [snapback]120603[/snapback]
jawdrop.gif  So I can actually block - totally block certain very annoying advertisers?


Yep! Find the URL that is serving up the ads, and put that URL in your hosts file with 127.0.0.1 as the IP address. Ta-da, goodby ads!
A whole lot about me: www.xeromag.com/franklin.html

Offline kimmer

  • Administrator
  • TS Addict
  • *****
  • Posts: 9086
    • View Profile
Questions regarding the "hosts" file
« Reply #13 on: March 03, 2007, 02:56:53 PM »
LOL! I tried it. I love it!!!!!!

Thanks for the tip!!!!!!