Build a DNS server in CentOS

Source: Internet
Author: User
Tags domain name server nameserver

Build a DNS server in CentOS

DNS performs forward and reverse resolution...

Full Qualified Domain Name Security Qualified host Name = Host Name. For example, www.tar ena.com.cn

Execute the program:/usr/sbin/named service Script:/etc/init. d/named default port: TCP/UDP 53

Virtual root environment:/var/named/chroot/Master configuration file:/etc/named. conf region data file:/var/named/

DNS log/var/log/messages

1. Build primary DNS

[Root @ songchunhui ~] # Yum-y install bindbind-chroot caching-nameserver

[Root @ songchunhui ~] # Service named restart

[Root @ songchunhui ~] # Chkconfig named on

[Root @ songchunhui ~] # Cd/var/named/chroot/etc/

[Root @ songchunhui etc] # cp-p named. caching-nameserver.confnamed.conf

[Root @ songchunhui etc] # vim named. conf

Options {define Global options

Listen-on port 53 {192.168.3.100;}; listening address and port

Listen-on-v6 port 53 {: 1 ;};

Directory "/var/named"; default location of the address file (region data file)

Allow-transfer {192.168.3.11;}; Authorize the slave DNS Server

............

Allow-query {any;}; allows all clients to query

Allow-query-cache {any ;};

};

View localhost_resolver {

Match-clients {any ;};

Match-destinations {any ;};

[Root @ songchunhui etc] # vimnamed. rfc1912.zones

Zone "tarena.com" IN {positive interpretation region tarena.com is a domain name

Type master; type is the main interpretation Area

File "tarena.com. zone"; the data file of the main interpretation region address

};

Zone "3.168.192.in-addr. arpa" IN {sets the reverse resolution region.

Type master;

File "tarena.com. arpa ";

};

[Root @ songchunhui etc] # named-checkconf/var/named/chroot/etc/named. conf no error, no output

[Root @ songchunhui etc] # cd/var/named/chroot/var/named/region data address

[Root @ songchunhui named] # cp-p named.localtarena.com. zone

[Root @ songchunhui named] # vimtarena.com. zone

$ TTL 86400 effective Lifecycle

@ INSOA dns01.tarena.com.root.tarena.com .(

2014062501; Serial update No.

28800; Refresh

14400; Retry

3600000; Expire

86400); Minimum

INNS dns01.tarena.com. Domain Name Server NS

IN NSdns02.tarena.com.

INA 192.168.3.100

Dns01 INA 192.168.3.100

Dns02 INA 192.168.3.11

Www INA 192.168.3.100 round-robin DNS configuration, DNS load balancing

Www INA 192.168.3.11 round robin DNS configuration, DNS load balancing

Bbs INA 1.1.1.2

Ftp IN CNAMEwww alias record

* INA 192.168.3.100 * wildcard domain name resolution

$ GENERATE 20-50 station $ in a 192.168.3. $ allocate the corresponding DNS and Host Name

[Root @ songchunhui named] # cp -ptarena.com. zone tarena.com. arpa

[Root @ songchunhui named] # vimtarena.com. arpa

$ TTL 86400

@ INSOA dns01.tarena.com.root.tarena.com .(

2014062501; Serial

28800; Refresh

14400; Retry

3600000; Expire

86400); Minimum

INNS dns01.tarena.com.

INNS dns02.tarena.com.

100 INPTR dns01.tarena.com. pointer record RTP

100 INPTR dns02.tarena.com.

2 INPTR mail.tarena.com.

5 INPTR www.tarena.com.

[Root @ songchunhui named] # named-checkzonetarena.com tarena.com. zone region Address File Syntax is correct

Zone tarena.com/IN: loaded serial2014062501

OK

[Root @ songchunhui named] # named-checkzonetarena.com tarena.com. arpa

Zone tarena.com/IN: loaded serial2014062501

OK

Testing on the local machine

[Root @ songchunhui etc] # dig www.tarena.com@192.168.3.100

[Root @ songchunhui etc] # host www.tar ena. com192.168.3.100

2. Build slave DNS

[Root @ dengziqi ~] # Yum-y remove bindbind-chroot caching-nameserver

[Root @ dengziqi ~] # Service named restart

[Root @ dengziqi ~] # Chkconfig named on

[Root @ dengziqi ~] # Cd/var/named/chroot/etc/

[Root @ dengziqi etc] # cp-p named. caching-nameserver.confnamed.conf

[Root @ dengziqi etc] # vim named. conf

15 listen-on port 53 {192.168.3.11 ;};

27 allow-query {any ;};

28 allow-query-cache {any ;};

37 match-clients {any ;};

38 match-destinations {any ;};

[Root @ dengziqi etc] # vimnamed. rfc1912.zones

50 zone "tarena.com" IN {

51 type slave; Change Region type to slave

52 file "slaves/tarena.com. zone"; save it to the slaves/subdirectory.

53 masters {192.168.3.100 ;};

54 };

55 zone "3.168.192.in-addr. arpa" IN {

56 type slave;

57 file "slaves/tarena.com. arpa ";

58 masters {192.168.3.100 ;};

59 };

[Root @ dengziqi etc] # named-checkconfnamed.conf

[Root @ dengziqi etc] # service named restart

[Root @ dengziqi etc] # ls/var/named/chroot/var/named/slaves/

Tarena.com. arpa tarena.com. zone

Test

[Root @ dengziqi slaves] # host www.tar ena. com192.168.3.100

[Root @ dengziqi slaves] # hostdns02.tarena.com 192.168.3.100

[Root @ dengziqi slaves] # dig www.tar ena. com192.168.3.100

Client DNS settings

Vim/etc/resolv. conf

Nameserver 192.168.3.100

Nameserver 192.168.3.11

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.