I think it's working on my hardy using poopypants step. Moreover, how to set it as dns proxy for networked computer?? It should be possible I guess. Thanks.
I think it's working on my hardy using poopypants step. Moreover, how to set it as dns proxy for networked computer?? It should be possible I guess. Thanks.
I wrote a perl program a while back to analyze the relative speeds of each of the DNS servers detected by dhcpcd (DHCP client daemon) through use of dig (a DNS lookup utility) and display a sorted list of DNS servers from fastest to slowest.
Here's the perl script and the corresponding output from the command line:
Code:#!/usr/bin/perl ###################################################################################### # scan_dns.pl version 0.7 9/20/07 # Author: Warren Watts (kingbeetle_66(at)yahoo(dot)com # This program will analyze the relative speeds of each of the DNS servers # detected by dhcpcd (DHCP client daemon) through use of dig (a DNS lookup utility) # and display a sorted list of DNS servers from fastest to slowest. # This sorted list can then be used to tweak the /etc/resolv.conf file, providing # faster DNS lookups while browsing, etc. # I included three domains for dig to lookup. They are stored in @domain_list. # Feel free to add to the list or change the domain list to any domains you wish. # Be aware that the more domains in the list, the longer the scan will take! ####################################################################################### use strict; my (@DNS,$IP,$time,$domain,$dig,%time,$key); # Read the DNS list from /etc/resolv.conf and store the list in an array my $resolv = `cat /etc/resolv.conf`; while ($resolv =~ /nameserver (.*)\n/g) {push(@DNS,$1)} #List the DNS servers listed in /etc.resolv.conf print "+----------------------------------------------------------------------+\n"; print "The following DNS servers are listed in /etc/resolv.conf:\n"; foreach $IP (@DNS) {print "$IP\t"} print "\n"; # Store list of domains to be looked up by dig in an array my @domain_list = ('www.yahoo.com' ,'www.fasthit.net' ,'zz.nullwave.ru'); # List the domains to be used by dig during the scan print "The following domains will be for this scan:\n"; foreach $domain (@domain_list) {print "$domain\t"} print "\n"; print "+----------------------------------------------------------------------+\n"; # Count number of domains stored in the array my $domain_count = @domain_list; # Go through the list of DNS servers and execute dig for each DNS server and each # domains in the domain list, extract the time taken and average the times together, # then store the DNS and averaged time in a hash. foreach $IP (@DNS) { print "Scanning $IP\n"; $time = ''; foreach $domain (@domain_list) { print "--> $domain\n"; $dig = `dig \@$IP $domain`; if ($dig =~ /Query time: (.*) msec/) { $time = $time + $1; } } $time{$IP} = int(($time / $domain_count) +0.5); } print "+----------------------------------------------------------------------+\n"; # Display the results sorted by time in ascending order foreach my $key (sort hashValueAscendingNum (keys(%time))) { print "Average fetch time for $key : $time{$key}\n"; } # Subroutine to sort by time rather than by DNS address sub hashValueAscendingNum { $time{$a} <=> $time{$b} }
Sample output:
You should be able to use this to test whether your local DNS cache is working, right?everyone@ubuntu550:~/Desktop$ perl test.pl
+----------------------------------------------------------------------+
The following DNS servers are listed in /etc/resolv.conf:
208.67.222.222 208.67.220.220 192.168.0.1
The following domains will be for this scan:
www.yahoo.com www.fasthit.net zz.nullwave.ru
+----------------------------------------------------------------------+
Scanning 208.67.222.222
--> www.yahoo.com
--> www.fasthit.net
--> zz.nullwave.ru
Scanning 208.67.220.220
--> www.yahoo.com
--> www.fasthit.net
--> zz.nullwave.ru
Scanning 192.168.0.1
--> www.yahoo.com
--> www.fasthit.net
--> zz.nullwave.ru
+----------------------------------------------------------------------+
Average fetch time for 208.67.222.222 : 43
Average fetch time for 208.67.220.220 : 291
Average fetch time for 192.168.0.1 : 834
I also included the script as a handy tarball as well.
Badges? We ain't got no badges. We don't need no badges. I don't have to show you any stinking badges!
Adventures In Linux
This is all I did in Jaunty, without any config file editing.
Quick Summary:
Choose "Use resolvconf". In the next line, replace eth0 with the name of your interface if it's different.Code:sudo cp /etc/resolv.conf /etc/resolv.conf.bak sudo apt-get install resolvconf sudo apt-get install pdnsd
Done! If you want step-by-step explanations:Code:sudo mv /etc/resolv.conf.bak /etc/resolvconf/run/interface/eth0 sudo resolvconf -u
Longer Steps:
First, save your current nameserver setup (this is not superfluous paranoia, you're going to need this later):
Next install resolvconf. If we don't install it first, we'll get weird errors from pdnsd because of how resolvconf replaces the /etc/resolv.conf file with a symbolic link:Code:sudo cp /etc/resolv.conf /etc/resolv.conf.bak
Next install pdnsd:Code:sudo apt-get install resolvconf
Choose "Use resolvconf".Code:sudo apt-get install pdnsd
You'd assume that it would just work, but it doesn't, cause the setup process has lost your original nameserver information.
So when you try to resolve a name, the system will look to resolvconf, who'll direct the request to pdnsd. Pdns has nothing cached yet, so it asks resolvconf for the next server to check, but resolvconf has no one to ask next.
So, we tell resolvconf that for that network interface, to use the config we were using before we started any of this. So move the backup file we made where resolvconf can see it. Since this was for my eth0 interface, I used:
Finally, update resolvconf with:Code:sudo mv /etc/resolv.conf.bak /etc/resolvconf/run/interface/eth0
Took me a few tries to pare this down, but this works for me, end to end.Code:sudo resolvconf -u
For a wireless config (where you're connecting to different networks), or if you just want to use say, OpenDNS for all of your interfaces all the time, just create a file /etc/resolvconf/run/interface/opendns with the following:
Then update resolvconf again with:Code:nameserver 208.67.222.222 nameserver 208.67.220.220
Hope this helps!Code:sudo resolvconf -u
Hester: 12.04 Desktop x64 | Core i5-2540M @ 2.6 GHz | 16GB DDR3 | 80GB SSD + 256GB SSD
Cortana: 12.04 Desktop x86 | Atom N270 @ 1.6 GHz | 2GB DDR2 | 32GB SSD
Horatio: 12.04 Server x64 | Atom N330 @ 1.6 GHz | 1GB DDR2 | 2.5TB
wow it worked from the help of above post real short and simple
Last edited by noren; October 12th, 2009 at 08:24 PM.
A bit late, but I haven't used this tool before. I run 8.04 and had the same problem as you and this solved it for me: pdnsd doesn't honor the settings in /etc/pdnsd.conf if AUTO_MODE is set in /etc/default/pdnsd and it is set to resolveconf by default. I.e. you can change whatever you want in /etc/pdnsd.conf and it will have no effect whatsoever.
The solution is to comment out AUTO_MODE in /etc/default/pdnsd, then /etc/pdnsd.conf will be used insted of /usr/share/pdnsd/pdnsd-$AUTO_MODE.conf (/usr/share/pdnsd/pdnsd-resolvconf.conf in most cases). You shouldn't edit /usr/share/pdnsd/pdnsd-$AUTO_MODE.conf directly as this file probably will be replaced when the package is upgraded.
If you want to see if it's actually caching anything you can do a lookup in the cache with pdnsd-ctl dump before and after you have done a dig:
Replace "google.com" with an address you haven't visited. The "[1]" after the first command means that grep couldn't find any hits for the string from the output of pdnsd-ctl dump.Code:USER @ Computer:~$ sudo pdnsd-ctl dump |grep -i google.com [1] USER @ COMPUTER:~$ dig @localhost google.com mx ... USER @ Computer:~$ sudo pdnsd-ctl dump |grep -i google.com google.com.
is there any way to use ad-block list with pdsd
I'd just like to say a big thank you.
I was wondering why my internet wasn't loading as fast as it did when i used windows, then i stumbled on this. thanks soooo much. My internet is now stupidly fast again
XFX nForce 790i motherboard, Intel 2.4Ghz quad core, 6GB DDR3 1333 RAM, 2x XFX GeForce 8800GS, 1TB + 500GB + 120GB hard drives, 22" and 15" monitor.
ALL RUNNING SWEET WITH UBUNTU!
I'm even lazier so avoided resolvconf by using the magical command:
And followed instructions exactly like the first postCode:sudo apt-get --no-install-recommends install pdnsd
i5-2500, Asus p8p67le, 8g ddr3, gtx460. Eeepc 701 4g surf.
vm.swappiness=0;noatime,data=writeback;deadline scheduler;preload.
FYI there is a bug registered on Launchpad: pdnsd requires manual restart after new WiFi connection gets established.
I was having all sorts of problems with this issue and (eventually) came up with the solution I posted there.
I installed pdnsd and resolvconf and chose the Manual setup when prompted.
Bookmarks