FREE THOUGHT · FREE SOFTWARE · FREE WORLD

Faster DNS Lookups

#!/bin/bash

HOSTS[0]=www.askapache.com
HOSTS[1]=s.askapache.net
HOSTS[2]=askapache.com
HOSTS[3]=www.google.com
HOSTS[4]=www.gnu.org
HOSTS[5]=www.google-analytics.com
HOSTS[6]=www.apple.com

NAMESERVERS[0]=208.67.222.222
NAMESERVERS[1]=208.67.220.220
NAMESERVERS[2]=65.24.0.168
NAMESERVERS[3]=65.24.0.169
NAMESERVERS[4]=8.8.8.8

for HOST in ${HOSTS[@]}; do
  echo; echo; echo "CHECKING $HOST LOOKUP TIMES"
  for NAMESERVER in ${NAMESERVERS[@]}; do
    host -t A -v $HOST $NAMESERVER|tail -n1|egrep -o '[0-9]+..*'
  done
done

208.67.222.222#53 in 18 ms
208.67.220.220#53 in 18 ms
65.24.0.168#53 in 23 ms
65.24.0.169#53 in 21 ms

Linux Optimization

 

 

Comments