Você está na página 1de 14

Primary Master Server

BIND9 can be used to serve DNS records (groups of


records are referred to as zones) for a registered
domain name or an imaginary one (but only if
used on a restricted network).
DNS Record Types

Address Records
The most commonly used type of record. This record maps an IP Address to a
hostname.

www IN A 1.2.3.4
Mail Exchange Records
Used to define where email should be sent to and at what priority. Must point to an A
record, not a CNAME. Multiple MX records can exist if multiple mail servers are
responsible for that domain.

IN MX 10 mail.srilanka.lk.

[...]

mail IN A 1.2.3.4
Name Server Records
Used to define which servers serve copies of this zone. It must point to an A
record, not a CNAME.
This is where Primary and Secondary servers are defined. Stealth servers are
intentionally omitted.

srilanka.lk. IN NS ns1.srilanka.lk.
.

[...]

ns1 IN A 1.2.3.4
Alias Records
Used to create an alias from an existing A record. You
can create a CNAME record pointing to another CNAME
record. But it doubles the number of requests made to
the nameserver, thus making it an inefficient way to do
so.

mail IN CNAME www


www IN A 1.2.3.4
Configuring BIND9

BIND9 Configuration files are stored in:

/etc/bind/

The main configuration is stored in the


following files:

/etc/bind/named.conf
/etc/bind/named.conf.options
/etc/bind/named.conf.local
Primary Master Server configuration
In this section BIND9 will be configured as the primary master for the domain
srilanka.lk.

Zone File
To add a DNS zone to BIND9, turning BIND9 into a Primary
Master server, all you have to do is edit named.conf.local

zone "example.com" {
type master;
file "/etc/bind/db.srilanka.lk";
};
Now use an existing zone file as a template:
cp /etc/bind/db.local /etc/bind/db.srilanka.lk
Edit the new zone file /etc/bind/db.srilanka.lk change localhost. to the FQDN of your server,
leaving the additional "." at the end. Change 127.0.0.1 to the nameserver's IP Address and
root.localhost to a valid email address, but with a "." instead of the "@". also leaving the "." at the
end.
Also, create an A record for ns.example.com the name server in this example:
;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA ns.example.com. root.example.com. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns.example.com.
@ IN A 192.168.1.10
box IN A 192.168.1.10

You must increment the serial number every time you make changes to the zone file
Tip: Many people like to use the last date edited as the serial of a zone, such as  2005010100  which
is yyyymmddss (where s is serial)
Once you've made a change to the zone file BIND9 will need to be restarted for the changes to
take affect:

/etc/init.d/bind9 restart
Testing

• You should now be able to ping srilanka.lk


and have it resolve to the host configured
above:

• ping srilanka.lk
Secondary Master Server
configuration
• Once a Primary Master has been configured a
Secondary Master is needed in order to
maintain the availability of the domain should
the Primary become unavailable.
First, on the primary master server, the zone transfer
needs to be allowed. Add the allow-transfer option to
the sample Forward and Reverse zone definition in

/etc/bind/named.conf.local:
zone “srilanka.lk" {
type master;
file "/etc/bind/db.srilanka.lk";
allow-transfer { @ip_secondary; };
};
Next, on the Secondary Master,

install the bind9 package the same way as the primary. Then edit the
/etc/bind/named.conf.local and add the following declarations for the Forward
and Reverse zones:

zone “srilanka.lk” {
type slave;
file "/var/cache/bind/db.srilanka.lk";
masters { @ip_master; };
};

Note: replace @ip_master with the IP Address of the Primary. The zone file
must be in /var/cache/bind/ because, by default,

Você também pode gostar