Skip to content

Instantly share code, notes, and snippets.

@andrewtj
Created August 21, 2023 03:41
Show Gist options
  • Save andrewtj/59f43e460fa6b4841798a4dfc5178d74 to your computer and use it in GitHub Desktop.
Save andrewtj/59f43e460fa6b4841798a4dfc5178d74 to your computer and use it in GitHub Desktop.
DNS zone file feature examples
$ORIGIN dns.omg.lol.
$TTL 3h2s ; TTL directive. Human friendly TTL format is a BIND-ism.
@ SOA ( ; parenthesis
mname ( ; can be
rname ( ; nested
1
) 2 3
4
5 )
)
TYPE2 \n\111\045\112\108\097\099\101\045\108\105\107\101-home ; <-- Generic TYPE mnemonic and an escaped label
\110\111\045\112\108\097\099\101\045\108\105\107\101-home TYPE1 \# 4 7f 00 00 01 ; <-- Generic RDATA format from RFC 3597
@ MX 3 no-place-like-home
MX 5 \110\111\045\112\108\097\099\101\045\108\105\107\101-home
relative IN 1 PTR a ; TTL and CLASS are both optional
1 IN PTR b ; and the order doesn't matter
TXT ( character "strings" are"also"\"\102\117\110\")
$GENERATE 1-2 $.this.$.feature PTR is.$.a.$.bit.$.clumsy.$.too
$ named-checkzone -dD dns.omg.lol ./dns.omg.lol.example.zone
loading "dns.omg.lol" from "./dns.omg.lol.example.zone" class "IN"
zone dns.omg.lol/IN: loaded serial 1
dumping "dns.omg.lol"
dns.omg.lol. 10802 IN SOA mname.dns.omg.lol. rname.dns.omg.lol. 1 2 3 4 5
dns.omg.lol. 10802 IN NS no-place-like-home.dns.omg.lol.
dns.omg.lol. 10802 IN MX 3 no-place-like-home.dns.omg.lol.
dns.omg.lol. 10802 IN MX 5 no-place-like-home.dns.omg.lol.
1.this.1.feature.dns.omg.lol. 10802 IN PTR is.1.a.1.bit.1.clumsy.1.too.dns.omg.lol.
2.this.2.feature.dns.omg.lol. 10802 IN PTR is.2.a.2.bit.2.clumsy.2.too.dns.omg.lol.
no-place-like-home.dns.omg.lol. 10802 IN A 127.0.0.1
relative.dns.omg.lol. 1 IN PTR a.dns.omg.lol.
relative.dns.omg.lol. 1 IN PTR b.dns.omg.lol.
relative.dns.omg.lol. 10802 IN TXT "character" "strings" "are" "also" "\"fun\""
OK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment