« Newer Snippets
Older Snippets »
6 total  XML / RSS feed 

Flush DNS cache

In Terminal, type:

lookupd -flushcache

DiG for gtcaz3

dig @dns1.textdrive.com alexandracheshire.com

; <<>> DiG 9.3.1 <<>> @dns1.textdrive.com alexandracheshire.com
; (1 server found)
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10904
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;alexandracheshire.com. IN A

;; ANSWER SECTION:
alexandracheshire.com. 2400 IN A 207.7.108.242

;; Query time: 33 msec
;; SERVER: 67.19.231.130#53(67.19.231.130)
;; WHEN: Wed Sep 7 19:59:38 2005
;; MSG SIZE rcvd: 55

DiG for gtcaz2

dig @dns1.textdrive.com cheshirelaw.textdriven.com

; <<>> DiG 9.3.1 <<>> @dns1.textdrive.com cheshirelaw.textdriven.com
; (1 server found)
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12577
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;cheshirelaw.textdriven.com. IN A

;; ANSWER SECTION:
cheshirelaw.textdriven.com. 2400 IN A 207.7.108.242

;; Query time: 39 msec
;; SERVER: 67.19.231.130#53(67.19.231.130)
;; WHEN: Wed Sep 7 19:55:01 2005
;; MSG SIZE rcvd: 60

DiG for Simplicio.com

dig @dns1.textdrive.com simplicio.com

; <<>> DiG 9.3.1 <<>> @dns1.textdrive.com simplicio.com
; (1 server found)
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 45365
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;simplicio.com. IN A

;; ANSWER SECTION:
simplicio.com. 1200 IN A 207.7.108.101

;; Query time: 40 msec
;; SERVER: 67.19.231.130#53(67.19.231.130)
;; WHEN: Wed Sep 7 19:37:33 2005
;; MSG SIZE rcvd: 47

DiG for gtcaz

dig @dns1.textdrive.com cheshirelaw.com

; <<>> DiG 9.3.1 <<>> @dns1.textdrive.com cheshirelaw.com
; (1 server found)
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 57856
;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;cheshirelaw.com. IN A

;; Query time: 38 msec
;; SERVER: 67.19.231.130#53(67.19.231.130)
;; WHEN: Wed Sep 7 19:51:25 2005
;; MSG SIZE rcvd: 33

How to flush the local DNS cache on Mac OS X

If you want to add a virtualhost on your Mac OS X box without having to wait around for ages, then the easiest way to do so is to shove a line into /etc/hosts and flush the dnscache. Here's a friendly bash function to throw into your .bashrc:

function edithosts {
        if [ -x "`which $EDITOR`" ] || [ -x "`which $1`" ]
        then
                if [ -x "`which $EDITOR`" ]
                then
                        export TEMP_EDIT="`which $EDITOR`"
                else
                        export TEMP_EDIT="`which $1`"
                fi
                echo "* Using ${TEMP_EDIT} as editor"
                $TEMP_EDIT /etc/hosts && echo "* Successfully edited /etc/hosts"
                lookupd -flushcache && echo "* Flushed local DNS cache"
        else
                echo "Usage: edithosts [editor]"
                echo "(The editor is optional, and defaults to \$EDITOR)"
        fi
        unset TEMP_EDIT
}


More simply, you can just flush the DNS cache manually with:

lookupd -flushcache
« Newer Snippets
Older Snippets »
6 total  XML / RSS feed