Please find the easy steps to install and configure the DNS Server on the Ubuntu System
Step 1:
Install Ubuntu dapper, or use your WORKING installation.
[root@localhost~:]#apt-get install bind9
Install dnsutils (which includes "dig")
[root@localhost~:]#apt-get install dnsutils
Step 2:
Confguration of the DNS Server - There a many ways to configure BIND9. Some of the most common configurations are a
Caching nameserver
Primary master(pdns) and
Secondary master(sdns)
Caching Server - When configured as a caching nameserver BIND9 will find the answer to name queries and remember the answer when the domain is queried again.
Primary Master Server - As a primary master server BIND9 reads the data for a zone from a file on it's host and is authoritative for that zone.
Secondary Master Server - In a secondary master configuration BIND9 gets the zone data from another nameserver authoritative for the zone.
Insight - An overview of the bind server.
The DNS configuration files are stored in the /etc/bind directory. The important files in this directory are:
/etc/bind/named.conf - The primary configuration file
[root@localhost~:]#cat /etc/bind/named.conf
The include line specifies the filename which contains the DNS options. The directory line in the /etc/bind/named.conf.options file tells DNS where to look for files. All files BIND uses will be relative to this directory.
/etc/bind/db.root - the root nameservers in the world
Caching Nameserver
The default configuration is setup to act as a caching server. All that is required is simply adding the IP Addresses of your ISP's DNS servers. Simply uncomment and edit the following in /etc/bind/named.conf.options:
Now restart the DNS server, to enable the new configuration. From a terminal prompt:
[root@localhost~:]#/etc/init.d/bind9 restart
Primary Master
In this section BIND9 will be configured as the Primary Master for the domain example.com. Simply replace example.com with your FQDN (Fully Qualified Domain Name).
Forward Zone File
To add a DNS zone to BIND9, turning BIND9 into a Primary Master server, the first step is to edit /etc/bind/named.conf.local:
zone "server.local" {
type master;
file "/etc/bind/db.server.local";
};
Now use an existing zone file as a template to create the /etc/bind/db.server.local file:
[root@localhost~:]#cp /etc/bind/db.local /etc/bind/db.server.local
Edit the new zone file /etc/bind/db.server.local 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 usual "@" symbol, again 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.server.local. root.server.local. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns.server.local.
@ IN A 192.168.1.10
ns IN A 192.168.1.10
Reverse Zone File
Now that the zone is setup and resolving names to IP Adresses a Reverse zone is also required. A Reverse zone allows DNS to resolve an address to a name.
Edit /etc/bind/named.conf.local and add the following:
zone "1.168.192.in-addr.arpa" {
type master;
notify no;
file "/etc/bind/db.192";
};
Now create the /etc/bind/db.192 file:
[root@localhost~:]#cp /etc/bind/db.127 /etc/bind/db.192
Next edit /etc/bind/db.192 changing the basically the same options as /etc/bind/db.server.local:
;
; BIND reverse data file for local loopback interface
;
$TTL 604800
@ IN SOA ns.server.local. root.server.local. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns.
10 IN PTR ns.server.local.
Restart the dns server
[root@localhost~:]#/etc/init.d/bind9 restart
Secondary Master
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 example Forward and Reverse zone definitions in /etc/bind/named.conf.local:
type master;
file "/etc/bind/db.server.local";
allow-transfer { 192.168.1.11; };
};
zone "1.168.192.in-addr.arpa" {
type master;
notify no;
file "/etc/bind/db.192";
allow-transfer { 192.168.1.11; };
};
Next, on the Secondary Master, install the bind9 package the same way as on the Primary. Then edit the /etc/bind/named.conf.local and add the following declarations for the Forward and Reverse zones:
zone "server.local" {
type slave;
file "db.server.local";
masters { 192.168.1.10; };
};
zone "1.168.192.in-addr.arpa" {
type slave;
file "db.192";
masters { 192.168.1.10; };
};
Restart BIND9 on the Secondary Master:
[root@localhost~:]#/etc/init.d/bind9 restart
Done.... :)
Cheers..
No comments:
Post a Comment