Skip to content

Instantly share code, notes, and snippets.

@AndersonIncorp
Last active November 5, 2017 17:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndersonIncorp/bee8ed48f453bdccdf166a68bf98bcf2 to your computer and use it in GitHub Desktop.
Save AndersonIncorp/bee8ed48f453bdccdf166a68bf98bcf2 to your computer and use it in GitHub Desktop.
DNS Self hosted subzone *.ip.example.com.
### Install BIND
# https://wiki.archlinux.org/index.php/BIND
pacman -S bind
### Configure named.conf
# cp /etc/named.conf /etc/named.conf.bak
# nano /etc/named.conf
# diff /etc/named.conf.bak /etc/named.conf
9c9
< // listen-on-v6 { any; };
---
> listen-on-v6 { any; };
13c13
< allow-recursion { 127.0.0.1; };
---
> allow-recursion { none; };
19a20,30
>
> max-cache-size 0;
> };
>
> controls { /* empty */ };
>
> zone "ip.example.com" IN {
> type master;
> file "ip.example.com.zone";
> allow-update { none; };
> notify no;
72a84,115
>
> // Log all in one file
> logging {
> channel named-log {
> file "/var/named/named.log" size 50m;
> print-category yes;
> print-severity yes;
> print-time yes;
> severity info;
> };
> category client { named-log; };
> category config { named-log; };
> category database { named-log; };
> category default { named-log; };
> category delegation-only { named-log; };
> category dispatch { named-log; };
> category dnssec { named-log; };
> category general { named-log; };
> category lame-servers { named-log; };
> category network { named-log; };
> category notify { named-log; };
> category queries { named-log; };
> category resolver { named-log; };
> category rpz { named-log; };
> category rate-limit { named-log; };
> category security { named-log; };
> category update { named-log; };
> category update-security { named-log; };
> category resolver { named-log; };
> category xfer-in { named-log; };
> category xfer-out { named-log; };
> };
# /var/named/ip.example.com.zone
$TTL 30M
$ORIGIN ip.example.com.
@ IN SOA ns1.ip.example.com. hostmaster.ip.example.com. (
2017100100 ; serial (yyyymmdd##) or whatever uint32_t
15M ; refresh
15M ; retry
1W ; expiry
30M) ; minimum ttl
; NS
IN NS ns1.ip.example.com.
IN NS ns2.ip.example.com.
IN NS ns71.domaincontrol.com. ; point back registator ns
IN NS ns72.domaincontrol.com. ;
; A for NS
IN A 203.0.113.1
IN AAAA 2001:DB8::1
ns1 IN A 203.0.113.1
ns1 IN AAAA 2001:DB8::1
ns2 IN A 203.0.113.1
ns2 IN AAAA 2001:DB8::1
; A for your subdomains
test IN A 203.0.113.1 ; test.ip.example.com
# Example DNS settings for registrator. Asssume 203.0.113.1,2001:DB8::1 is our ip.
# NS Can be entered added as ns1.ip.@ / ns2.ip.@
NS
A @ 203.0.113.1 30 min
A ns1.ip 203.0.113.1 30 min
A ns2.ip 203.0.113.1 30 min
AAAA @ 2001:DB8::1 30 min
AAAA ns1.ip 2001:DB8::1 30 min
AAAA ns2.ip 2001:DB8::1 30 min
CNAME www example.com. 30 min
NS ip ns1.ip.example.com. 30 min
NS ip ns2.ip.example.com. 30 min
TXT @ v=spf1 mx ~all 30 min
MX @ example.com.(Priority:0) 30 min
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment