Rhel dns configuration tutorial

Source: Internet
Author: User
Tags nameserver nslookup

To: xx

Note: The local IP address is 118.229.139.68.

1. Install the following package

 
Bind-libs-9.3.6-4.P1.el5bind-9.3.6-4.P1.el5bind-utils-9.3.6-4.P1.el5bind-chroot-9.3.6-4.P1.el5caching-nameserver-9.3.6-4.P1.el5

 

Run the rpm-Qa | grep bind-command to query

 
[Root @ pcbake ~] # Rpm-Qa | grep bind-bind-libs-9.3.6-4.P1.el5bind-9.3.6-4.P1.el5bind-utils-9.3.6-4.P1.el5bind-chroot-9.3.6-4.P1.el5ypbind-1.19-12.el5 [root @ pcbake ~] # Rpm-Qa | grep cachlibXfontcache-1.0.2-3.1libXfontcache-devel-1.0.2-3.1distcache-1.4.5-14.1caching-nameserver-9.3.6-4.P1.el5

2. Edit the named. conf file.

 
[Root @ pcbake etc] # PWD/var/named/chroot/etclisten-on port 53 {118.229.139.68 ;};// Change the local IP address hereAllow-query {Any ;};// Change the two places to anyMatch-Clients {Any ;};

 

 

3. Edit the/etc/named. rfc112.zones file.

Add two zones

 
Zone"Yangyh123.com"In {type master; file"Yangyh123.com. Zone"; Allow-update {none ;};}; Zone"139.229.118.in-ADDR. ARPA"In {type master; file"Yangyh123.com. Rev"; Allow-update {none ;};};

 

 

4. Create two files: yangyh123.com. Rev and yangyh123.com. Zone., The content is as follows:

 [root @ pcbake named] # PWD/var/named/chroot/var/named [root @ pcbake named] # ls  data  named. broadcast named. local yangyh123.com. revlocaldomain. zone named. CA named. zero yangyh123.com. zonelocalhost. zone named. ip6.local slaves [root @ pcbake named] # [root @ pcbake named] # Cat yangyh123.com. rev $ TTL 86400 @ in SOA localhost. root. localhost. (1997022700; Serial 28800; refresh 14400; retry 3600000; expire 86400); minimum in NS yangyh123.com. 68 in PTR www.yangyh123.com. [root @ pcbake named] # 
[Root @ pcbake named] # Cat yangyh123.com. zone $ TTL 86400 @ in SOA localhost. root. localhost. (42; Serial (D. adams) 3 h; refresh 15 m; retry 1 W; expiry 1D); minimum in NS localhostyangyh123.com. in a 118.229.139.43www.yangyh123.com. in a 118.229.139.43mail.yangyh123.com. in a 118.229.139.43 [root @ pcbake named] #

5. Named-checkzone
[Root @ pcbake named] # named-checkzone usage: named-checkzone [-djqvd] [-CClass] [-O output] [-T Directory] [-W Directory] [-K (ignore |Warn| Fail)] [-N (ignore |Warn| Fail)] zonename filename [root @ pcbake named] # named-checkzone yangyh123.com/var/named/chroot/var/named/yangyh123.com. zone zone yangyh123.com/in: loaded serial 42ok [root @ pcbake named] # named-checkzone 139.229.118.in-ADDR. ARPA/var/named/chroot/var/named/yangyh123.com. rev zone 139.229.118.in-ADDR. ARPA/In: loaded serial 1997022700ok [root @ pcbake named] #

 

 
6. Change/etc/resolv. conf. Note that the local IP address is in front...
[Root @ pcbake named] # Cat/etc/resolv. conf; generated by/sbin/dhclient-script;SearchBupt.edu.cn; nameserver 211.68.71.4nameserver 118.229.139.68 nameserver 211.68.71.5 [root @ pcbake named] #
 
7. Run service named restart
 
[Root @ pcbake named] # lsof-I: 53 command PID user FD type device size node namednsmasq 4281 nobody 6u IPv4 12980 TCP 192.168.122.1: domain (Listen) dnsmasq 4281 nobody 7u IPv4 12981 UDP 192.168.122.1: domain named 12937 named 20u IPv6 66378 TCP localhost6.localdomain6: domain (Listen) named 12937 named 21u IPv4 66380 TCP www.yangyh123.com: domain (Listen) named 12937 named 512u IPv6 66377 UDP localhost6.localdomain6: domain named 12937 named 513u IPv4 66379 UDP www.yangyh123.com: domain [root @ pcbake named] #

 
8. Test
 
[Root @ pcbake named] # NSLookup www. yangyh123.comserver: 118.229.139.68address: 118.229.139.68 #53 name: www. yangyh123.comaddress: Configure [root @ pcbake named] # NSLookup yangyh123.comserver: Role: role #53 name: yangyh123.comaddress: role [root @ pcbake named] # NSLookup mail. yangyh123.comserver: 118.229.139.68address: 118.229.139.68 #53 name: mail. yangyh123.comaddress: 118.229.139.43 [root @ pcbake named] #
 
[Root @ pcbake named] # NSLookup 118.229.139.68server: 118.229.139.68address: 118.229.139.68 # 5368.139.229.118.in-ADDR. ARPAName= Www.yangyh123.com. [root @ pcbake named] #
[Root @ pcbake named] # NSLookup Baidu.com; got servfail reply from nation, trying next serverserver: 211.68.71.5address: 211.68.71.5 # 53non-authoritative answer: Name: Baidu. comaddress: 123.125.114.144name: Baidu. comaddress: 220.181.111.85name: Baidu. comaddress: 220.181.111.86 [root @ pcbake named] #

Attachment:. Zone,. Rev File

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.