Wednesday, 4 September 2013

Dns server configuration on linux


Configure static IP for me

IP address: 192.168.1.50
subnet mask: 255.255.255.0
Dns:              192.168.1.50





[root@server named]# cat /etc/resolv.conf
# Generated by NetworkManager
search techxpert.com
nameserver 192.168.1.50


[root@server Desktop]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=server.techxpert.com


[root@server Desktop]# cat /etc/hosts
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.1.50 server.techxpert.com server

[root@server Desktop]# yum install bind* -y

[root@server Desktop]# nano /etc/named.conf

_______________________________________________________________________________
//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//

options {
listen-on port 53 { 127.0.0.1; 192.168.1.50; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query     { localhost; 192.168.1.0/24; };
recursion yes;

dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;

/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

zone "." IN {
type hint;
file "named.ca";
};

include "/etc/named.rfc1912.zones";
_______________________________________________________________________________

[root@server Desktop]# nano /etc/named.rfc1912.zones

________________________________________________________________________________
// named.rfc1912.zones:
//
// Provided by Red Hat caching-nameserver package 
//
// ISC BIND named zone configuration for zones recommended by
// RFC 1912 section 4.1 : localhost TLDs and address zones
// and http://www.ietf.org/internet-drafts/draft-ietf-dnsop-default-local-zones-02.txt
// (c)2007 R W Franks
// 
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//

zone "localhost.localdomain" IN {
type master;
file "named.localhost";
allow-update { none; };
};

zone "localhost" IN {
type master;
file "named.localhost";
allow-update { none; };
};

zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
type master;
file "named.loopback";
allow-update { none; };
};

zone "techxpert.com" IN {
type master;
file "for.techxpert.com";
allow-update { none; };
};

zone "1.168.192.in-addr.arpa" IN {
type master;
file "rev.techxpert.com";
allow-update { none; };
};
________________________________________________________________________________

[root@server Desktop]# cd /var/named/
[root@server named]# cp named.loopback rev.techxpert.com
[root@server named]# cp named.localhost for.techxpert.com
[root@server named]# chgrp named rev.techxpert.com
[root@server named]# chgrp named for.techxpert.com
[root@server named]# nano for.techxpert.com

_________________________________________________________________________________
$TTL 1D
@ IN SOA server.techxpert.com. root.techxpert.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
@ IN NS server.techxpert.com.
server IN A 192.168.1.50
station51 IN A 192.168.1.51

_________________________________________________________________________________

[root@server named]# nano rev.techxpert.com

_________________________________________________________________________________

$TTL 1D
@ IN SOA server.techxpert.com. root.techxpert.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
@ IN NS server.techxpert.com.
server IN A 192.168.1.50
50 IN PTR server.techxpert.com.
51 IN PTR station51.techxpert.com.

________________________________________________________________________________

[root@server named]# service named restart
Stopping named:                                            [  OK  ]
Starting named:                                            [  OK  ]


[root@server named]# nslookup server.techxpert.com
Server: 192.168.1.50
Address: 192.168.1.50#53

Name: server.techxpert.com
Address: 192.168.1.50

[root@server named]# nslookup station51.techxpert.com
Server: 192.168.1.50
Address: 192.168.1.50#53

Name: station51.techxpert.com
Address: 192.168.1.51

[root@server named]# nslookup 192.168.1.51
Server: 192.168.1.50
Address: 192.168.1.50#53

51.1.168.192.in-addr.arpa name = station51.techxpert.com.

[root@server named]# nslookup 192.168.1.50
Server: 192.168.1.50
Address: 192.168.1.50#53

50.1.168.192.in-addr.arpa name = server.techxpert.com.


No comments:

Post a Comment