Created
March 15, 2016 17:19
-
-
Save markjenkins/0468e956e8f310562b09 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$INCLUDE "/etc/bind/common_TTL_SOA_NS_CNAME_MX_for_cool_zones.db"; | |
@ A 192.168.1.186 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$INCLUDE "/etc/bind/common_TTL_SOA_NS_CNAME_MX_for_cool_zones.db"; | |
@ A 127.0.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; default TTL | |
$TTL 3h | |
; common SOA | |
@ IN SOA cool.tld. domains.cool.tld. ( | |
2008081401 ; serial, todays date + todays serial | |
3H ; slave refresh frequency | |
15M ; slave retry rate when refresh fails | |
4W ; expire time until slaves give up on refresh | |
2D ) ; minimum-TTL if one isn't specified | |
; common NS | |
@ NS cool.tld. | |
; common CNAME | |
www CNAME @ | |
; common MX | |
@ MX 10 cool.tld. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$INCLUDE "/etc/bind/common_TTL_SOA_NS_CNAME_MX_A_for_cool_zones.db"; | |
$INCLUDE "/etc/bind/cool_extra_sub_domains.db"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pics CNAME @ | |
chat CNAME @ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$INCLUDE "/etc/bind/common_TTL_SOA_NS_CNAME_MX_A_for_internal_cool_zones.db"; | |
$INCLUDE "/etc/bind/cool_extra_sub_domains.db"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from optparse import OptionParser | |
from sys import stdout | |
option_parser = OptionParser() | |
option_parser.add_option("-p", "--prefix", default="") | |
option_parser.add_option("-s", "--suffix", default="") | |
(options, args) = option_parser.parse_args() | |
def iterjoin(join_str, iterable): | |
first = True | |
for value in iterable: | |
if not first: | |
yield join_str | |
else: | |
first = False | |
yield value | |
if len(args) > 0: | |
input_file = file(args[0]) | |
stdout.writelines( | |
iterjoin("\n", | |
("""zone "%(zone_name)s" { | |
\tfile "%(file_prefix)s%(zone_name)s%(file_suffix)s"; | |
\ttype master; | |
}; | |
""" % {'zone_name': line.strip(), | |
'file_prefix': options.prefix, | |
'file_suffix': options.suffix, } | |
for line in input_file | |
if len(line.strip()) > 0 ) ) ) | |
input_file.close() | |
else: | |
exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Makefile | |
ZONE_LIST=zone_list_file | |
ZONE_FILE_SUFFIX=".db" | |
all: zone_list.zones internal_zone_list.zones | |
zone_list.zones: $(ZONE_LIST) Makefile | |
./make_zone_list --prefix "/etc/bind/" \ | |
--suffix $(ZONE_FILE_SUFFIX) $^ > $@ | |
internal_zone_list.zones: $(ZONE_LIST) Makefile | |
./make_zone_list --prefix "/etc/bind/internal_" \ | |
--suffix $(ZONE_FILE_SUFFIX) $^ > $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is named.conf, it implements split DNS | |
include "/etc/bind/named.conf.options"; | |
view "local_network" | |
{ | |
match-clients {localhost; }; | |
recursion yes; | |
// prime the server with knowledge of the root servers | |
zone "." { | |
type hint; | |
file "/etc/bind/db.root"; | |
}; | |
// Consider adding the 1918 zones here, if they are not used in your | |
// organization | |
include "/etc/bind/zones.rfc1918"; | |
// be authoritative for the localhost forward and reverse zones, and for | |
// broadcast zones as per RFC 1912 | |
zone "localhost" { | |
type master; | |
file "/etc/bind/db.local"; | |
}; | |
zone "127.in-addr.arpa" { | |
type master; | |
file "/etc/bind/db.127"; | |
}; | |
zone "0.in-addr.arpa" { | |
type master; | |
file "/etc/bind/db.0"; | |
}; | |
zone "255.in-addr.arpa" { | |
type master; | |
file "/etc/bind/db.255"; | |
}; | |
include "/etc/bind/internal_zone_list.zones"; | |
}; | |
view "external_network" | |
{ | |
match-clients {!localhost; any; }; | |
recursion no; | |
// prime the server with knowledge of the root servers | |
zone "." { | |
type hint; | |
file "/etc/bind/db.root"; | |
}; | |
include "/etc/bind/zone_list.zones"; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zone "cool.tld" { | |
file "/etc/bind/cool.tld.db"; | |
type master; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cool.tld | |
super.tld |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment