Install Bind DNS Server on Ubuntu 13.04 12.10 Debian

Howto Install Bind DNS Server on Ubuntu 13.04 12.10 Debian

 

DNS Server What is

 

 

1. Install Bind DNS Server on Ubuntu / Debian

root@ubuntu:~# sudo apt-get install bind9
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
bind9utils
Suggested packages:
bind9-doc
The following NEW packages will be installed:
bind9 bind9utils
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 542 kB of archives.
After this operation, 1,459 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://us.archive.ubuntu.com/ubuntu/ raring/main bind9utils amd64 1:9.9.2.dfsg.P1-2ubuntu2 [147 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ raring/main bind9 amd64 1:9.9.2.dfsg.P1-2ubuntu2 [396 kB]
Fetched 542 kB in 6s (78.2 kB/s)
Preconfiguring packages …
Selecting previously unselected package bind9utils.
(Reading database … 59518 files and directories currently installed.)
Unpacking bind9utils (from …/bind9utils_1%3a9.9.2.dfsg.P1-2ubuntu2_amd64.deb) …
Selecting previously unselected package bind9.
Unpacking bind9 (from …/bind9_1%3a9.9.2.dfsg.P1-2ubuntu2_amd64.deb) …
Processing triggers for man-db …
Processing triggers for ufw …
Processing triggers for ureadahead …
Setting up bind9utils (1:9.9.2.dfsg.P1-2ubuntu2) …
Setting up bind9 (1:9.9.2.dfsg.P1-2ubuntu2) …
Adding group `bind’ (GID 115) …
Done.
Adding system user `bind’ (UID 107) …
Adding new user `bind’ (UID 107) with group `bind’ …
Not creating home directory `/var/cache/bind’.
wrote key file “/etc/bind/rndc.key”
#
* Starting domain name service… bind9 [ OK ]
Processing triggers for ufw …
Processing triggers for ureadahead …
root@ubuntu:~#

2.  Configure named configuration with domain ithelpblog.local and Reverse IP range 192.168.129.0/24.

root@ubuntu:~# cat /etc/bind/named.conf.local
//
// Do any local configuration here
//// Consider adding the 1918 zones here, if they are not used in your
// organization
//include “/etc/bind/zones.rfc1918”;# Our domain zone
zone “ithelpblog.local” {
type master;
file “/etc/bind/zones/ithelpblog.local.db”;
};
# For reverse DNS
zone “129.168.192.in-addr.arpa” {
type master;
file “/etc/bind/zones/rev.129.168.192.in-addr.arpa”;
};
root@ubuntu:~#

3. Create DNS forwarder on Bind DNS Server

root@ubuntu:~# cat /etc/bind/named.conf.options
options {
directory “/var/cache/bind”;// If there is a firewall between you and nameservers you want
// to talk to, you may need to fix the firewall to allow multiple
// ports to talk. See http://www.kb.cert.org/vuls/id/800113// If your ISP provided one or more IP addresses for stable
// nameservers, you probably want to use them as forwarders.
// Uncomment the following block, and insert the addresses replacing
// the all-0’s placeholder.
forwarders {

8.8.8.8;
};
//====================================================================== ==
// If BIND logs error messages about the root key being expired,
// you will need to update your keys. See https://www.isc.org/bind-keys
//====================================================================== ==
dnssec-validation auto;auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
};
root@ubuntu:~#

4. Create and configure zone

root@ubuntu:~# sudo mkdir /etc/bind/zones
root@ubuntu:~# sudo nano /etc/bind/zones/ithelpblog.local.db
;
; BIND zone definition file for ithelpblog.local
;
ithelpblog.local. IN SOA ns1.ithelpblog.local. admin.ithelpblog.local. (
2011072601; Serial
28800
3600
604800
38400
)

; Nameserver and mailserver (replace with your own hostnames):
ithelpblog.local. IN NS ns1.ithelpblog.local.
ithelpblog.local IN MX 10 mail.ithelpblog.local.
; IP addresses of local hosts (replace the lines with your own hosts):
win IN A 192.168.129.2
ns1 IN A 192.168.129.151
www IN A 192.168.129.2
ubuntu IN A 192.168.129.151
root@ubuntu:~#

Create reverse zone

root@ubuntu:~# cat /etc/bind/zones/rev.129.168.192.in-addr.arpa
$TTL 3D
@ IN SOA ns.ithelpblog.local. admin.ithelpblog.local. (
2007062001
28800
604800
604800
86400
)
IN NS ns.ithelpblog.local.
254 IN PTR gw.ithelpblog.local.
151 IN PTR ubuntu.ithelpblog.local.
1 IN PTR win.ithelpblog.local.
root@ubuntu:~#

 

5.  Test DNS Server by dig command

root@ubuntu:~# dig win.ithelpblog.local
; <<>> DiG 9.9.2-P1 <<>> win.ithelpblog.local
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57733
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 2;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;win.ithelpblog.local. IN A;; ANSWER SECTION:
win.ithelpblog.local. 38400 IN A 192.168.129.2;; AUTHORITY SECTION:
ithelpblog.local. 38400 IN NS ns1.ithelpblog.local.;; ADDITIONAL SECTION:
ns1.ithelpblog.local. 38400 IN A 192.168.129.151;; Query time: 3 msec
;; SERVER: 192.168.129.151#53(192.168.129.151)
;; WHEN: Mon Jul 15 05:34:48 2013
;; MSG SIZE rcvd: 99

That’s all. Thanks for using IThelpblog.com.

 

 

Leave a reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>