Hey, I had a problem over the past three years with my computer taking forever to resolve URLs. I recently learned how to change DNS servers in Ubuntu 12.04 LTS, but I still had the same delays. I noticed a marked improvement after several hours with the new DNS provider, but I began to study about creating a HOSTS file from scratch as a means to do domain and host name blocking for uninvited advertisements.

I started with a basic entry for my email provider and for my online banking, and tested it immediately. I had to learn how to display the original HOSTS file so I could copy anything important to my own version. I learned about vi /etc/hosts and used my mouse to select the contents and save them elsewhere.

Then I did the hard part, which was to install my HOSTS version using the sudo mv command. I had trouble following the directory structure to locate my file because I am new to the CLI Terminal. I ended up saving my NewHOSTS.txt file to my Desktop and I used CLI Terminal to move it from there to the /etc/hosts. I was pleasantly surprised that my test file with only a couple of entries worked the first time. But I had a lot to learn about the power of the HOSTS file to speed up my linking, and redirecting, and handovers. I began to catalog all the URLs I saw in my web browser address bar and then I added the host names to my HOSTS file. It was like a snowball effect where I was clicking around a lot faster and getting quicker display results. Even websites not listed in my HOSTS file began to appear more quickly as well.

I also added to my HOSTS file my DNS servers (for practice) and even all of the Mozilla Firefox support domains and hosts. Now when I click the Help section in Firefox, I get near instant results and there is no waiting for resolution of URLs.

Then at some point I realized that I could do the same thing with the Ubuntu Forums and the Ubuntu servers for downloading updates. I had to figure out how to get all the names, so I tried looking at the Update Manager process and made it search for updates. I was able to get some host and domains from that, but there was another place I tried and then I had enough to work with. Maybe I was using the CLI Terminal to do the apt-get update and saw more of the Ubuntu host server names there. I noticed immediate results with faster Update Manager, faster CLI Terminal update search, and even the Ubuntu Software Center appears to be displaying faster.

I did my HOSTS file from data I gleaned using the nslookup command in the CLI Terminal. I was able to get IP addresses and I even noticed some useful data to include, like aliases to the IP address and host names. After about a week, I have built up a HOSTS fie to the size of just under 700 KB. It will still fit nicely on a floppy disk.

I like the fact that the HOSTS file is portable. I can place it in cloud storage for emergency recovery or on a thumb drive for local recovery or backup purposes.

Because I had the primary purpose of blocking unwanted domains and host names, I did a lot of that early on, using data I collected earlier on host names and domains I did not want. I learned quickly about the 127.0.0.1 address for the unwanted domains. But when I began to move away from blocking and on to connecting without the wasted time of DNS and delays for service, I focused on the places I visit often or want to visit. I catalogued many websites that would be of use to me. I listed my email servers, my cloud storage, my elected officals and the major branches of local, county, state, and federal government, and I had a fun time getting to know the HOSTS file and have practical exercise with creating and storing and moving the HOSTS file.

I have already done the work for speeding up my connections on Ubuntu 12.04 for my DSL modem. If anyone would like to see the data on Ubuntu servers or on Mozilla Firefox Support, let me know and I will post those sections from my HOST file here in this thread for all to use.