OpenNetGuru

Saturday, May 19th

Last update:12:30:26 PM GMT

You are here: Network and Security DNS server in Ubuntu / debian

DNS server in Ubuntu / debian

E-mail Print PDF

To create a simple Local DNS server we need do the following steps,
Required files:
* BIND
* /etc/resolve.conf

* /etc/named.conf

STEPS:-
1) apt-get install bind9 dnsutils
2) edit: /etc/resolve.conf

search sysnx.com
nameserver 192.168.1.10
nameserver 192.168.1.20

3)edit:/etc/bind/named.conf
here we need to add the zone information and to specify the master and slave server.

zone “sysnx.com” {
type master;
file “/etc/bind/fwd.zone”;
};

zone “1.168.192.in-addr.arpa” {
type master;
file “/etc/bind/rev.zone”;
};

4) Configuring the Zone File
in the /etc/bind/ folder we can see the files called dc.local and db.127
we need to make a copy as fwd.zone and rev.zone.

cp db.local fwd.zone
cp db.127 rev.zone

and replace the localhost to our domain name for example,
fwd.zone
;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA sysnx.com. root.sysnx.com. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS sysnx.com.
@ IN A 192.168.1.10

rev.zone
root@my-linux:/etc/bind# cat rev.zone
;
; BIND reverse data file for local loopback interface
;
$TTL 604800
@ IN SOA sysnx.com. root.sysnx.com. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS sysnx.com.
10 IN PTR sysnx.com.

5) Testing the DNS Server

a) nslookup sysnx.com

Server: 192.168.1.10
Address: 192.168.1.10#53

Name: sysnx.com
Address: 192.168.1.10

b) dig sysnx.com
; <> DiG 9.4.1-P1 <> sysnx.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 42424
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;sysnx.com. IN A

;; ANSWER SECTION:
sysnx.com. 604800 IN A 192.168.1.10

;; AUTHORITY SECTION:
sysnx.com. 604800 IN NS sysnx.com.

;; Query time: 1 msec
;; SERVER: 192.168.1.10#53(192.168.1.10)
;; WHEN: Sat Mar 1 05:28:10 2008
;; MSG SIZE rcvd: 66