Loading ...
Sorry, an error occurred while loading the content.

Have you modified your HOSTS file yet?

Expand Messages
  • dbneeley
    Here at home in Ukraine, I have a very fast connection but the DNS lookup service is horrible. Some sites can take so long to try to resolve that they time
    Message 1 of 3 , Dec 3, 2010
    • 0 Attachment
      Here at home in Ukraine, I have a very fast connection but the DNS lookup service is horrible. Some sites can take so long to try to resolve that they time out and must be reloaded again.

      However, until today I had ignored updating my "hosts" file. Now that I have, I wonder what kept me so long...and boy, is my face red!

      As you may know, every operating system that allows Internet access has a local file that lists IP numbers and the corresponding URL. The standard one in Linux distros may only have the 127.0.0.1 address listed as "localhost." The standard one in Ubuntu-derived distros is a little longer, but not all that much.

      However, it is simple to add the sites you often access. You can also add various advertising sites, for example, that you want not to be bothered with--which also greatly speeds up page loading since most ads will no longer be loaded.

      Fortunately, there are several sites that have pre-built lists of most of the ad sites as well as many known sites that host malware, which are simply listed in the hosts file with the localhost address.

      Here's what you do:

      I got the large file of hosts I didn't want to see from http://someonewhocares.org/hosts/

      Next, I opened a terminal and found the IP addresses for the sites I visit regularly, using the "host" command. For example:

      > host google.com

      It returns the IP addresses. I did the same thing with the other sites I use every day and made a list of them.

      Next, locate the "hosts" file on your machine. The most common setup is /etc/hosts (as it is in Ubuntu, for example).

      That file has to be edited as root--so since I use KDE, I opened a terminal and entered "kdesudo kate" and then opened the file in the Kate editor. You could also use gedit or any other text editor, so long as you open the file as root.

      I first saved the original with a different name--in my case I called it hosts_original.

      Then, moving back to the original file, I entered the frequent sites list, using the same format: IP address followed by any number of spaces or tabs, the URL, then more spaces or tabs and a nickname if I wished. That way, you can use a shorthand name for the site in your address bar if you wish.

      Note that large sites like Google will have more than one IP address; put each of them on its own line and repeat the URL listing.

      Note that you cannot use wild cards in the HOSTS file, so each IP address must be on a separate line.

      Finally, I copied the file from the someonewhocares.org site at the bottom of the HOSTS file and saved it all as simply "hosts" in the original location.

      Then, either stop and restart your networking services or simply reboot.

      Suddenly, things will load much faster and you will no longer be bothered with most of the online advertising or the tracking sites that compromise your privacy.

      The entire operation took perhaps fifteen minutes at most, and the difference for me is much like night and day.

      I hope you find this helpful if you have never done it.

      Best to all,

      David
    • loyal_barber
      ... Another way to do this that is safer for any IP address that might change is to set up a caching DNS server then point all of your computers to it first
      Message 2 of 3 , Dec 3, 2010
      • 0 Attachment
        --- In LINUX_Newbies@yahoogroups.com, "dbneeley" <dbneeley@...> wrote:
        >
        > Here at home in Ukraine, I have a very fast connection but the DNS lookup service is horrible. Some sites can take so long to try to resolve that they time out and must be reloaded again.
        >
        > However, until today I had ignored updating my "hosts" file. Now that I have, I wonder what kept me so long...and boy, is my face red!
        >
        > As you may know, every operating system that allows Internet access has a local file that lists IP numbers and the corresponding URL. The standard one in Linux distros may only have the 127.0.0.1 address listed as "localhost." The standard one in Ubuntu-derived distros is a little longer, but not all that much.
        >
        > However, it is simple to add the sites you often access. You can also add various advertising sites, for example, that you want not to be bothered with--which also greatly speeds up page loading since most ads will no longer be loaded.
        >
        > Fortunately, there are several sites that have pre-built lists of most of the ad sites as well as many known sites that host malware, which are simply listed in the hosts file with the localhost address.
        >
        > Here's what you do:
        >
        > I got the large file of hosts I didn't want to see from http://someonewhocares.org/hosts/
        >
        > Next, I opened a terminal and found the IP addresses for the sites I visit regularly, using the "host" command. For example:
        >
        > > host google.com
        >
        > It returns the IP addresses. I did the same thing with the other sites I use every day and made a list of them.
        >
        > Next, locate the "hosts" file on your machine. The most common setup is /etc/hosts (as it is in Ubuntu, for example).
        >
        > That file has to be edited as root--so since I use KDE, I opened a terminal and entered "kdesudo kate" and then opened the file in the Kate editor. You could also use gedit or any other text editor, so long as you open the file as root.
        >
        > I first saved the original with a different name--in my case I called it hosts_original.
        >
        > Then, moving back to the original file, I entered the frequent sites list, using the same format: IP address followed by any number of spaces or tabs, the URL, then more spaces or tabs and a nickname if I wished. That way, you can use a shorthand name for the site in your address bar if you wish.
        >
        > Note that large sites like Google will have more than one IP address; put each of them on its own line and repeat the URL listing.
        >
        > Note that you cannot use wild cards in the HOSTS file, so each IP address must be on a separate line.
        >
        > Finally, I copied the file from the someonewhocares.org site at the bottom of the HOSTS file and saved it all as simply "hosts" in the original location.
        >
        > Then, either stop and restart your networking services or simply reboot.
        >
        > Suddenly, things will load much faster and you will no longer be bothered with most of the online advertising or the tracking sites that compromise your privacy.
        >
        > The entire operation took perhaps fifteen minutes at most, and the difference for me is much like night and day.
        >
        > I hope you find this helpful if you have never done it.
        >
        > Best to all,
        >
        > David
        >

        Another way to do this that is safer for any IP address that might
        change is to set up a caching DNS server then point all of your
        computers to it first then secondarily to your current DNS. I changed
        the DNS settings in my router to point to my caching server first.

        Loyal
      • dbneeley
        Loyal, That presupposes two things: that you have a spare computer to run it on (which I don t), and that it is simple enough for newbies to do. These days,
        Message 3 of 3 , Dec 3, 2010
        • 0 Attachment
          Loyal,

          That presupposes two things: that you have a spare computer to run it on (which I don't), and that it is simple enough for "newbies" to do.

          These days, I get by with my one laptop--the days of having five or six machines around are long gone. (At one point when I was back in Dallas, I had set up a portable shelving unit with six computers, both a laser and a workgroup-scale inkjet printer, and a scanner as well as a KVM switch so I could use one keyboard, monitor, and mouse for the whole shebang. Now, living in Ukraine, I have a single laptop, a couple of external hard disks and an external DVD unit. It works off a wireless router, as does my stepson's desktop and his netbook.)

          You are correct, though, that any dynamic IPs would not be any better with a hosts file customized. However, the major sites generally don't use dynamic IP addresses.

          While obviously there are some on this list who are far from being "newbies" themselves, others are most definitely newcomers. For them, editing the hosts file is something they can do easily enough, with big enough benefits that it is a worthwhile activity. After doing it, they will see a boost in their Internet performance--although that boost will depend partly on how good their own DNS access is, it should still be more than trivial--especially if they commonly visit advertising-laden websites.

          David

          David


          --- In LINUX_Newbies@yahoogroups.com, "loyal_barber" <loyal_barber@...> wrote:

          >
          > Another way to do this that is safer for any IP address that might
          > change is to set up a caching DNS server then point all of your
          > computers to it first then secondarily to your current DNS. I changed
          > the DNS settings in my router to point to my caching server first.
          >
          > Loyal
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.