Server IP Address: 192.168.1.121
Hostname: newyork.example.com
[root@newyork named]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:0c:29:a8:9e:61
NM_CONTROLLED=no
ONBOOT=yes
IPADDR=192.168.1.121
BOOTPROTO=none
NETMASK=255.255.255.0
TYPE=Ethernet
GATEWAY=192.168.1.1
IPV6INIT=no
USERCTL=no
[root@newyork named]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=newyork.example.com
[root@newyork named]# service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
[root@newyork ~]# yum install -y *bind* caching-nameserver
[root@newyork ~]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:0C:29:A8:9E:61
inet addr:192.168.1.121 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fea8:9e61/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:138 errors:0 dropped:0 overruns:0 frame:0
TX packets:184 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:13080 (12.7 KiB) TX bytes:29969 (29.2 KiB)
Interrupt:19 Base address:0x2024
[root@newyork ~]# cd /etc/
[root@newyork etc]# ll named*
-rw-r----- 1 root named 930 Feb 15 2010 named.conf
-rw-r--r-- 1 root named 601 May 26 2010 named.iscdlv.key
-rw-r----- 1 root named 931 Jun 21 2007 named.rfc1912.zones
named:
total 0
[root@newyork etc]# cp named.conf named.conf.orig
[root@newyork etc]# vi 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 { 192.168.1.121; };
# 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 { any; };
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@newyork etc]# cp named.rfc1912.zones named.rfc1912.zones.orig
[root@newyork etc]# vi 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 "example.com" IN {
type master;
file "forward.zone";
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 "1.168.192.in-addr.arpa" IN {
type master;
file "reverse.zone";
allow-update { none; };
};
zone "0.in-addr.arpa" IN {
type master;
file "named.empty";
allow-update { none; };
};
[root@newyork etc]# chgrp named named.conf
[root@newyork etc]# cd /var/named/
[root@newyork named]# cp named.localhost forward.zone
[root@newyork named]# cp named.loopback reverse.zone
[root@newyork named]# vi forward.zone
$TTL 1D
@ IN SOA newyork.example.com. root.newyork.example.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS newyork.example.com.
newyork IN A 192.168.1.121
[root@newyork named]# vi reverse.zone
$TTL 1D
@ IN SOA newyork.example.com. root.newyork.example.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
IN NS newyork.example.com.
121 IN PTR newyork.example.com.
[root@newyork named]# chgrp named forward.zone
[root@newyork named]# chgrp named reverse.zone
[root@newyork named]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
192.168.1.121 newyork.example.com newyork
[root@newyork named]# vi /etc/resolv.conf
# Generated by NetworkManager
search example.com
nameserver 192.168.1.121
# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lab.foo.com bar.foo.com
[root@newyork named]# service named restart
Stopping named: [ OK ]
Starting named: [ OK ]
[root@newyork named]# dig newyork.example.com
; <<>> DiG 9.7.0-P2-RedHat-9.7.0-5.P2.el6 <<>> newyork.example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 1113
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;newyork.example.com. IN A
;; ANSWER SECTION:
newyork.example.com. 86400 IN A 192.168.1.121
;; AUTHORITY SECTION:
example.com. 86400 IN NS newyork.example.com.
;; Query time: 1 msec
;; SERVER: 192.168.1.121#53(192.168.1.121)
;; WHEN: Wed Jan 16 11:26:32 2013
;; MSG SIZE rcvd: 67
[root@newyork named]# dig -x 192.168.1.121
; <<>> DiG 9.7.0-P2-RedHat-9.7.0-5.P2.el6 <<>> -x 192.168.1.121
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 57162
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;121.1.168.192.in-addr.arpa. IN PTR
;; ANSWER SECTION:
121.1.168.192.in-addr.arpa. 86400 IN PTR newyork.example.com.
;; AUTHORITY SECTION:
1.168.192.in-addr.arpa. 86400 IN NS newyork.example.com.
;; ADDITIONAL SECTION:
newyork.example.com. 86400 IN A 192.168.1.121
;; Query time: 1 msec
;; SERVER: 192.168.1.121#53(192.168.1.121)
;; WHEN: Wed Jan 16 11:26:59 2013
;; MSG SIZE rcvd: 107
[root@newyork named]# nslookup newyork.example.com
Server: 192.168.1.121
Address: 192.168.1.121#53
Name: newyork.example.com
Address: 192.168.1.121
[root@newyork named]# nslookup 192.168.1.121
Server: 192.168.1.121
Address: 192.168.1.121#53
121.1.168.192.in-addr.arpa name = newyork.example.com.
[root@newyork named]# chkconfig named --list
named 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@newyork named]# chkconfig named on
[root@newyork named]# chkconfig named --list
named 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Comments
Post a Comment