Check Website
Inclusion Status
It is currently Thu Jul 29, 2010 4:06 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 14 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Large HOSTS file + DNS Client service = faster machine!
PostPosted: Sat Aug 23, 2008 9:05 pm 
They said it couldn't be done. They said you couldn't install a large HOSTS file on a machine which has the DNS Client service running because it tends to slow down the machine.

They were wrong!

I have a HOSTS file with nearly 170,000 blocked sites on a Celeron XP Home machine with no slowdown except at bootup. There is a 4 or 5 second delay when the HOSTS file is read and cached. After that, everything is faster because DNS lookups are cached and the HOSTS file does not have to be accessed constantly.

How, you say? By putting multiple HostNames on the same line! So far, I have been able to put a maximum of nine HostNames on one line. This page describes the format of the HOSTS file in detail:
http://publib.boulder.ibm.com/infocenter/systems/topic/com.ibm.aix.files/doc/aixfiles/hosts.htm

A sample line from my HOSTS file looks like this:
Code:
127.0.0.1 antispyware2008.name antispyware2008.org antispyware2008a.com antispyware2008buy.com antispyware2008c.com antispyware2008purchase.com antispyware2008soft.com antispyware2008y.com antispywareadaware.com


It sure took a long time to edit the file and put nine HostNames on each line, though. Just kidding! I have custom awk scripts to manage my HOSTS file and the part that does the work looks like this:
Code:
BEGIN{
  printf "127.0.0.1 localhost localhost.localdomain\n"
# add your favorite sites here:
  printf "212.56.95.253  hosts-file.net www.hosts-file.net forum.hosts-file.net\n"
}
/^127/||/^0/{
  lcase=tolower($2)
  if (lcase=="localhost"||lcase=="localhost.localdomain") {next}
  if (lcase in j) {next}
  j[lcase]
  a[++i]=lcase
  if (i==9){
   printf "127.0.0.1 %s %s %s %s %s %s %s %s %s\n",a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9]
   i=0
  }
}END{
  if (i>0){
     printf "127.0.0.1"
   for (k=1;k<=i;k++) {printf " %s",a[k]}
   printf "\n"
  }
}

Now, what do I win for this amazing discovery?? Smile

Edit: fix coding error
Edit: remove unnecessary line of code


Last edited by Guest on Mon Aug 25, 2008 5:55 pm, edited 2 times in total.


IP:
top
Top
  
 
 Post subject: Re: Large HOSTS file + DNS Client service = faster machine!
PostPosted: Sat Aug 23, 2008 9:52 pm 
Offline
Site Admin

Joined: Thu May 28, 2009 11:25 am
Posts: 3576
hehe nice one Smile (wasn't aware of that as MS doesn't document it, and I've not seen it mentioned elsewhere).

... I don't have a prize for you to win ... Embarassed ... but check out the Emsisoft sub-forums if you've not already Wink

_________________
Regards
Steven Burn
Ur I.T. Mate Group / hpHosts
it-mate.co.uk / hosts-file.net

Keeping it FREE!



IP:
top
Top
 Profile  
 
 Post subject: Re: Large HOSTS file + DNS Client service = faster machine!
PostPosted: Sat Aug 23, 2008 10:03 pm 
Thanks for the pointer, Steve! I think I will stick with Comodo. I am enjoying my faster machine too much to risk any changes now! Smile



IP:
top
Top
  
 
 Post subject: Re: Large HOSTS file + DNS Client service = faster machine!
PostPosted: Sat Aug 23, 2008 10:05 pm 
Offline
Site Admin

Joined: Thu May 28, 2009 11:25 am
Posts: 3576
hehe Wink

_________________
Regards
Steven Burn
Ur I.T. Mate Group / hpHosts
it-mate.co.uk / hosts-file.net

Keeping it FREE!



IP:
top
Top
 Profile  
 
 Post subject: Re: Large HOSTS file + DNS Client service = faster machine!
PostPosted: Mon Aug 25, 2008 12:53 pm 
You now made me kind of jealous... Mr. Green



IP:
top
Top
  
 
 Post subject: Re: Large HOSTS file + DNS Client service = faster machine!
PostPosted: Mon Aug 25, 2008 5:53 pm 
Uh, getting back to the hosts file, I think a few more words would be helpful to the uninitiated. To make this work, you will need an awk interpreter. I have found a very fast one here:
http://www.klabaster.com/progs/mawk32.zip

Unpack it and copy mawk.exe to a directory somewhere in your path.

Copy the script code into a file named hosts.awk or something and then from the command line (or batch file) type:
Code:
mawk -f hosts.awk HOSTS > HOSTS_NEW
ren HOSTS HOSTS_OLD
ren HOSTS_NEW HOSTS
SC START DNSCache
ipconfig /displaydns

Each time the HOSTS file is updated you can type:
Code:
ipconfig /flushdns
ipconfig /displaydns

The /displaydns command will cause the new HOSTS file to be read and cached, which may take several seconds. Enjoy your faster machine! Smile

Edit: typo
Edit: change makw32 to mawk


Last edited by Guest on Sun Oct 12, 2008 3:10 am, edited 2 times in total.


IP:
top
Top
  
 
 Post subject: Re: Large HOSTS file + DNS Client service = faster machine!
PostPosted: Mon Aug 25, 2008 6:55 pm 
Offline
Site Admin

Joined: Thu May 28, 2009 11:25 am
Posts: 3576
I've added a link to this thread to the download page Smile

http://hosts-file.net/?s=Download#hostswithdns

_________________
Regards
Steven Burn
Ur I.T. Mate Group / hpHosts
it-mate.co.uk / hosts-file.net

Keeping it FREE!



IP:
top
Top
 Profile  
 
 Post subject: Re: Large HOSTS file + DNS Client service = faster machine!
PostPosted: Mon Aug 25, 2008 7:51 pm 
Thank you very much, Steven! Smile



IP:
top
Top
  
 
 Post subject: Re: Large HOSTS file + DNS Client service = faster machine!
PostPosted: Mon Aug 25, 2008 10:38 pm 
@ retired

Just out of curiosity, I ran Spybot, to see what it would say about the hosts file entries... guess what? It went crazy. Wouldn't even perform a scan to the system. Kept saying the scan was cancelled by the user. Shocked Very Happy



IP:
top
Top
  
 
 Post subject: Re: Large HOSTS file + DNS Client service = faster machine!
PostPosted: Mon Aug 25, 2008 11:58 pm 
Soultrain wrote:
@ retired

Just out of curiosity, I ran Spybot, to see what it would say about the hosts file entries... guess what? It went crazy. Wouldn't even perform a scan to the system. Kept saying the scan was cancelled by the user. Shocked Very Happy

Oh oh, the games begin! Laughing I don't use Spybot, but there is nothing wrong with the format of the new HOSTS file. It follows the convention described on this page:
http://publib.boulder.ibm.com/infocenter/systems/topic/com.ibm.aix.files/doc/aixfiles/hosts.htm
So, I suppose you could make a post on their forums and ask for a program update??
http://forums.spybot.info/

In any case, thanks for the feedback!

Regards,
Retired



IP:
top
Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
hpHosts and hpHosts Online are copyright © Ur I.T. Mate Group - All Rights Reserved

Powered by phpBB © 2000-2009 phpBB Group