Professional Documents
Culture Documents
//
// named.caching-nameserver.conf
//
// Provided by Red Hat caching-nameserver 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.
//
// DO NOT EDIT THIS FILE - use system-config-bind or an editor
// to create named.conf - edits to this file will be lost on
// caching-nameserver package upgrade.
//
options {
listen-on port 53 { 127.0.0.1;192.168.1.20; };
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; };
allow-query-cache { localhost;192.168.1.0/24; };
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
//view localhost_resolver {
//match-clients { localhost; };
//match-destinations { localhost; };
//recursion yes;
//include "/etc/named.rfc1912.zones";
//};
zone "tmsir.ma" IN {
type master;
file "tmsir.zone";
allow-transfer { 192.168.1.30; };
notify yes ;
allow-update {192.168.1.30;}
};
zone "1.168.192.in-addr.arpa" IN {
type master;
file "tmsir.rev";
allow-transfer { 192.168.1.30; };
notify yes ;
allow-update {192.168.1.30;}
};
Step-2: Edit Forward Lookup zone file for Secondary DNS server record
[root@ns1 ~]# cd /var/named/chroot/var/named/
[root@ns1 named]# gedit tmsir.zone
Original File: tmsir.zone
$TTL 86400
@ IN SOA srv.tmsir.ma. root.tmsir.ma. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN A 127.0.0.1
IN AAAA ::1
@ IN NS srv.tmsir.ma.
@ IN NS srv1.tmsir.ma.
srv.tmsir.ma. IN A 192.168.1.10
srv1.tmsir.ma. IN A 192.168.1.20
pc1.tmsir.ma. IN A 192.168.1.11
pc2.tmsir.ma. IN A 192.168.1.12
www IN CNAME ns1.tmsir.ma.
Step-3: Edit Reverse Lookup zone file for Secondary DNS server record
[root@ns1 named]# gedit tmsir.rev
$TTL 86400
@ IN SOA srv.tmsir.ma. root.tmsir.ma. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN A 127.0.0.1
IN AAAA ::1
@ IN NS srv.tmsir.ma.
@ IN NS srv1.tmsir.ma.
10 IN PTR srv.tmsir.ma.
20 IN PTR srv1.tmsir.ma.
11 IN PTR pc1.tmsir.ma.
12 IN PTR pc2.tmsir.ma.
Step-4: Check the named.conf & zone file by following this commands,
[root@ns1 ~]# named-checkconf /var/named/chroot/etc/named.conf
[root@ns1 ~]# named-checkzone tmsir.ma /var/named/chroot/var/named/tmsir.zone
[root@ns1 ~]# named-checkzone tmsir.ma /var/named/chroot/var/named/tmsir.rev
Step-1: To check bind and caching-nameserver rpm package is installed or not by following this
command:
(if installed then it will show bind packages)
If not installed, then installed the packages using Yum command:
[root@ns2 ~]# Yum Install bind* caching-nameserver*
Step-2: Check and Configure the Network Card:
(Original File):
#Broadcom Corporation Net link BCM57875 Gigabyte Ethernet PCI Express
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:0C:29: EB: B2: CA
ONBOOT=yes
(Modified File):
#Broadcom Corporation Net link BCM57875 Gigabyte Ethernet PCI Express
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:0C:29: EB: B2: CA
ONBOOT=yes
TYPE=Ethernet
PEERDNS=no
USERCTL=no
IPV6INIT=no
IPADDR=192.168.1.20
NETMASK=255.255.255.0
NETWORK=192.168.1.0
BROADCAST=192.168.1.255
After changing you have to reload/restart the NIC(eth0) card by following command:
[root@ns2 ~]# ifdown eth0
[root@ns2 ~]# ifup eth0
[root@ns2 ~]# service network restart
Step-3: After complete the NIC configure you have to change the host name by following this
command:
[root@ns2 ~]# vi /etc/sysconfig/network
(Original File):
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=localhost.localdomain
(Modified File):
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=srv1
(Modified File):
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
192.168.1.10 srv.tmsir.ma srv
192.168.1.20 srv1.tmsir.ma srv1
Step-5: Copy & Rename the named.rfc1912.zones file to named.conf file & Change the ownership &
permission by following this command:
[root@ns2 ~]# cd /var/named/chroot/etc/
[root@ns2 etc]# cp named.caching-nameserver.conf named.conf
[root@ns2 etc]# chown root:named named.conf
[root@ns2 etc]# chmod 777 named.conf
fichier source
//
// named.caching-nameserver.conf
//
// Provided by Red Hat caching-nameserver 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.
//
// DO NOT EDIT THIS FILE - use system-config-bind or an editor
// to create named.conf - edits to this file will be lost on
// caching-nameserver package upgrade.
//
options {
listen-on port 53 { 127.0.0.1; };
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; };
allow-query-cache { localhost; };
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
view localhost_resolver {
match-clients { localhost; };
match-destinations { localhost; };
recursion yes;
include "/etc/named.rfc1912.zones";
};
allow-query { localhost;192.168.1.0/24; };
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
//view localhost_resolver {
//match-clients { localhost; };
//match-destinations { localhost; };
//recursion yes;
//include "/etc/named.rfc1912.zones";
//};
zone "tmsir.ma" IN {
type slave;
file "tmsir.zone";
masters { 192.168.1.10; };
allow-notify {192.168.1.20; };
};
zone "1.168.192.in-addr.arpa" IN {
type slave;
file "tmsir.rev";
masters { 192.168.1.10; };
allow-notify {192.168.1.20; };
};
Step-8: Start the named service, that it will automatically copy the forward & reverse lookup zone file from
Primary DNS server.
[root@ns2 ~]# service iptables stop
[root@ns2 ~]# service network restart
[root@ns2 ~]# chkconfig named on
[root@ns2 ~]# service named restart
Step-9: Check the DNS server by following this command. Also check the Primary DNS from
secondary DNS.
[root@ns2 ~]# host 192.168.1.20
[root@ns2 ~]# host srv1.tmsir.ma
[root@ns2 ~]# Ping srv1.tmsir.ma
[root@ns2 ~]# nslookup srv1.tmsir.ma
[root@ns2 ~]# nslookup 192.168.1.20
[root@ns2 ~]# dig srv2.tmsir.ma
[root@ns2 ~]# dig –x 192.168.1.20
[root@ns2 ~]# dig –x srv1.tmsir.ma
[root@ns2 ~]# dig –t SOA tmsir.ma
[root@ns2 ~]# dig –t axfr tmsir.ma