Ubuntu server 12.04/dns

From Attie's Wiki
(Difference between revisions)
Jump to: navigation, search
m
m
 
(12 intermediate revisions by one user not shown)
Line 1: Line 1:
 +
[[ubuntu_server_12.04|Ubuntu Server 12.04]]
 
<source lang="bash">
 
<source lang="bash">
 
apt-get install bind9 dnsutils
 
apt-get install bind9 dnsutils
Line 4: Line 5:
  
 
==Control The Server==
 
==Control The Server==
Service control:
 
 
<source lang="bash">
 
<source lang="bash">
 
service bind9 restart
 
service bind9 restart
Line 11: Line 11:
 
Check the config (it just fails with no error message if you get it wrong):
 
Check the config (it just fails with no error message if you get it wrong):
 
<source lang="bash">
 
<source lang="bash">
named-checkconf
+
named-checkconf -z
 
</source>
 
</source>
  
 
==Configure the Server==
 
==Configure the Server==
 +
Make it run resolvconf on start:
 +
<source lang="bash">
 +
sed -re 's/^(RESOLVCONF=).+$/\1yes/' -i /etc/default/bind9
 +
</source>
 +
 
Config files are in <code>/etc/bind</code>.
 
Config files are in <code>/etc/bind</code>.
  
Line 24: Line 29:
 
<code>/etc/bind/named.conf.zones</code> contains one line per zone:
 
<code>/etc/bind/named.conf.zones</code> contains one line per zone:
 
<source lang="text">
 
<source lang="text">
zone "attie.co.uk" in { type master; file "/etc/bind/zones/attie.co.uk"; notify yes; };
+
zone "attie.co.uk" in { type master; notify yes; file "/etc/bind/zones/attie.co.uk"; };
 
</source>
 
</source>
  
Zone configs are stored in <code>/etc/bind/zones/</code>. E.g:
+
Zone configs are stored in <code>/etc/bind/zones/</code>. E.g: <code>/etc/bind/zones/attie.co.uk</code>
 
<source lang="text">
 
<source lang="text">
 +
;
 +
; BIND data file for local loopback interface
 +
;
 
$TTL    604800
 
$TTL    604800
  
 
;####################################################
 
;####################################################
 
; domain configuration
 
; domain configuration
@       IN      SOA    akela.attie.co.uk.      ; primary NS
+
@               SOA    ns.attie.co.uk attie@attie.co.uk. ( ; master ns / hostmaster email
                        attie@attie.co.uk. (   ; hostmaster email
+
 
                               2                ; Serial
 
                               2                ; Serial
 
                         604800                ; Refresh
 
                         604800                ; Refresh
Line 41: Line 48:
 
                         604800 )              ; Negative Cache TTL
 
                         604800 )              ; Negative Cache TTL
  
@                      NS      akela.attie.co.uk.
+
@                      NS      ns.attie.co.uk.
 +
ns                      A      192.168.0.251
  
 
;####################################################
 
;####################################################
Line 65: Line 73:
 
doc.libxbee            CNAME  attie.co.uk.
 
doc.libxbee            CNAME  attie.co.uk.
  
cgi                    CNAME  attie.co.uk.
 
 
wiki                    CNAME  attie.co.uk.
 
wiki                    CNAME  attie.co.uk.
 
git                    CNAME  attie.co.uk.
 
git                    CNAME  attie.co.uk.
Line 72: Line 79:
 
;####################################################
 
;####################################################
 
; physical machines
 
; physical machines
akela                  CNAME  attie.co.uk.
 
 
baloo                  A      192.168.0.1
 
baloo                  A      192.168.0.1
 +
akela                  A      192.168.0.251
 
</source>
 
</source>

Latest revision as of 16:43, 13 March 2016

Ubuntu Server 12.04

apt-get install bind9 dnsutils

[edit] Control The Server

service bind9 restart

Check the config (it just fails with no error message if you get it wrong):

named-checkconf -z

[edit] Configure the Server

Make it run resolvconf on start:

sed -re 's/^(RESOLVCONF=).+$/\1yes/' -i /etc/default/bind9

Config files are in /etc/bind.

I have added the following line to /etc/bind/named.conf:

include "/etc/bind/named.conf.zones";

/etc/bind/named.conf.zones contains one line per zone:

zone "attie.co.uk" in { type master; notify yes; file "/etc/bind/zones/attie.co.uk"; };

Zone configs are stored in /etc/bind/zones/. E.g: /etc/bind/zones/attie.co.uk

;
; BIND data file for local loopback interface
;
$TTL    604800
 
;####################################################
; domain configuration
@               SOA     ns.attie.co.uk attie@attie.co.uk. ( ; master ns / hostmaster email
                              2                 ; Serial
                         604800                 ; Refresh
                          86400                 ; Retry
                        2419200                 ; Expire
                         604800 )               ; Negative Cache TTL
 
@                       NS      ns.attie.co.uk.
ns                      A       192.168.0.251
 
;####################################################
; mail
@                       MX 1    aspmx.l.google.com.
@                       MX 5    alt1.aspmx.l.google.com.
@                       MX 5    alt2.aspmx.l.google.com.
@                       MX 10   aspmx2.googlemail.com.
@                       MX 10   aspmx3.googlemail.com.
@                       MX 10   aspmx4.googlemail.com.
@                       MX 10   aspmx5.googlemail.com.
 
@                       TXT     v=spf1 a mx ~all
 
;####################################################
; aliases
@                       A       192.168.0.251
www                     CNAME   attie.co.uk.
 
mail                    CNAME   ghs.google.com.
 
libxbee                 CNAME   attie.co.uk.
doc.libxbee             CNAME   attie.co.uk.
 
wiki                    CNAME   attie.co.uk.
git                     CNAME   attie.co.uk.
svn                     CNAME   attie.co.uk.
 
;####################################################
; physical machines
baloo                   A       192.168.0.1
akela                   A       192.168.0.251
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox