Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

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

Check DNS lookup in Tiger

lookupd -configuration

Look for the following in the output:
LookupOrder: Cache FF DNS NI DS
_config_name: Host Configuration


The FF (flat file) refers to your hosts file (/etc/hosts), and Tiger does check its contents before going to DNS and Netinfo. Just a little FYI for those who may not have realized that 10.4 fixed things.


godaddy wildcard dns entry

To add a wildcard dns entry, make it an A record with proper IP address destination

@ <IP address of web server>
* <IP address of web server>

Generate a bind9 rndc key

// description of your code here

dnssec-keygen -a hmac-md5 -b 256 -n HOST mybrandnewkey


The result will be something like "K%2Ftmp%2Fmybrandnewkey.+157+42885", so you do

cat K%2Ftmp%2Fmybrandnewkey.+157+42885.private


Put the key in /etc/rndc.key like this:
key "rndc-key" {
        algorithm hmac-md5;
        secret "Hr1U28EsMhp8r0TEEjAmksoldReEYuiWwQFH0/gkk6I=";
};

bind9 rndc.conf template

I'm in your /etc, managing your named.

include "/etc/rndc.key";

options {
default-server  127.0.0.1;
default-key     "rndc-key";
};

bind9 google apps zone template

Change 1.2.3.4 for your accelerator's ip and mydomain.net for your domain name

$TTL 86400
@ IN SOA ns1.mydomain.net. hostmaster.mydomain.net. (
                              2007052701      ; serial
                              3H              ; refresh
                              15M             ; retry
                              1W              ; expiry
                              1D )            ; minimum

                    IN NS     ns1.mydomain.net.
                    IN NS     ns1.everydns.net.
                    IN NS     ns2.everydns.net.
                    IN NS     ns3.everydns.net.
                    IN NS     ns4.everydns.net.

@                   IN TXT    "v=spf1 ip4:1.2.3.4 include:gmail.com~all include:mydomain.joyent.net~all ~all"

@                   IN MX   1 aspmx.l.google.com.
@                   IN MX   3 alt1.aspmx.l.google.com.
@                   IN MX   3 alt2.aspmx.l.google.com.
@                   IN MX   5 aspmx2.googlemail.com.
@                   IN MX   5 aspmx3.googlemail.com.
@                   IN MX   5 aspmx4.googlemail.com.
@                   IN MX   5 aspmx5.googlemail.com.

_xmpp-server._tcp   IN SRV  5 0 5269 xmpp-server.l.google.com.
_xmpp-server._tcp   IN SRV 20 0 5269 xmpp-server1.l.google.com.
_xmpp-server._tcp   IN SRV 20 0 5269 xmpp-server2.l.google.com.
_xmpp-server._tcp   IN SRV 20 0 5269 xmpp-server3.l.google.com.
_xmpp-server._tcp   IN SRV 20 0 5269 xmpp-server4.l.google.com.

_jabber._tcp        IN SRV  5 0 5269 xmpp-server.l.google.com.
_jabber._tcp        IN SRV 20 0 5269 xmpp-server1.l.google.com.
_jabber._tcp        IN SRV 20 0 5269 xmpp-server2.l.google.com.
_jabber._tcp        IN SRV 20 0 5269 xmpp-server3.l.google.com.
_jabber._tcp        IN SRV 20 0 5269 xmpp-server4.l.google.com.


@                   IN A      1.2.3.4
www                 IN CNAME  @
mail                IN CNAME  ghs.google.com.
start               IN CNAME  ghs.google.com.
calendar            IN CNAME  ghs.google.com.

bind9 0.0.127.in-addr.arpa template

Refered as /var/named/named.local in my named.conf template

$TTL    86400
@       IN      SOA     localhost. root.localhost.  (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
              IN      NS      localhost.

1       IN      PTR     localhost.

bind9 localhost.zone template

Localhost zone template.

$TTL    86400
$ORIGIN localhost.
@                       1D IN SOA       @ root (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum

                        1D IN NS        @
                        1D IN A         127.0.0.1

bind9 named.conf template

Replace 1.2.3.4 with your accelerator's public ip.

acl "internals" { 1.2.3.4 ; 127.0.0/8 ; };
acl "everydns" { 64.158.219.0/24; 4.79.232.0/24; 38.99.14.0/24; 216.218.240.206; 80.84.249.169; 63.219.183.200; };
acl "gandi" { 217.70.177.40; }

options {
        directory "/var/named";
        allow-recursion { "internals"; };
        allow-transfer { "internals"; "everydns"; "gandi";};
        statistics-file "/var/log/named.stats";
        listen-on { 127.0.0.1; 1.2.3.4; };
        forwarders { 208.67.220.220; 208.67.222.222; };
};

include "/etc/rndc.key";

controls {
        inet 127.0.0.1 port 953 allow { 127.0.0.1; } keys { "rndc-key"; };
};

logging {
        channel namedlog {
                file "/var/log/named.log" versions 5 size 2m;
                print-time yes;
                print-category yes;
        };
        category xfer-out { namedlog; };
        category security { namedlog; };
        category lame-servers { null; };
};

zone "." { type hint; file "named.root"; };
zone "0.0.127.in-addr.arpa" { type master; file "named.local"; };
zone "localhost" { type master; file "localhost.zone"; };

zone "mydomain.net" { type master; file "mydomain.net.zone"; };

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 »
15 total  XML / RSS feed