DNS configuration (multiple domain names, multiple IP addresses, and one IP address for multiple domain names)

Source: Internet
Author: User
Tags nameserver

1. DNS system functions:

Forward resolution: Find the corresponding IP address based on the host name (domain name)

Reverse resolution: Find the host domain name based on the IP address

DNS query method:

Recursive query:

Most clients resolve domain names to the DNS server. After accessing a DNS server, an answer is returned to the client. If it is not the target, the client will continue to access the DNS server.

Iterative query:

Most DNS servers resolve domain names to other DNS servers and access them continuously through the DNS server.

2. DNS domain name server type

Cache Domain Name Server

Obtain the domain name by querying other domain name servers-> the IP address record caches the domain name query results locally, improving the speed of repeated queries

Primary Domain Name Server

The official server in a specific DNS region. It is unique and is responsible for maintaining the ing records of all domain names> IP addresses in the region.

Slave Domain Name Server

This is also called the secondary Domain Name Server. The Domain Name> ip address record maintained by the secondary Domain Name Server comes from the primary domain name server.

 

3. The client performs a test on the DNS server:

1) Ping www.baidu.com

2) host www.baidu.com

3) NSLookup www.baidu.com

4) http://www.baidu.com directly access the domain name through a browser

4. VI/etc/hosts performs domain name resolution. If you have a resolution table, you will get the resolution. If not, you will find the DNS server. In Windows, C: \ windows \ system32 \ drivers \ etc \ hosts

5. cache DNS Server

1) records the addresses of 13 Global root DNS servers

2) cache resolution records

3) provides a template for setting the primary DNS Server

Primary DNS Server

1) Resolve frequently accessed domain names to IP addresses on the primary DNS Server

Slave DNS Server

1) synchronize the parsing data in the primary DNS Server

6. Disable iptables and SELinux.

 

7,

BIND server program

Main execution program:/usr/sbin/named

Service Script:/etc/init. d/named

Default listening port: 53

Main configuration file:

/Var/named/chroot/etc/

The data file that saves the DNS resolution record is located:

/Var/named/chroot/var/named/

Lab:

Master/Slave DNS Server

S1: primary DNS> IP: 192.168.20.1

S2: slave DNS-> IP: 192.168.20.2

C1: 192.168.20.111

 

Www.lamp.com 192.168.20.1

Mp3.lamp.com 192.168.20.2

Ftp.lamp.com 192.168.20.1

1. Install DNS Software

1. Install DNS Software

Yum-y install bind *

2. Because the DNS software has a cache, you only need to install the cache software (directly installed as the cache DNS server)

Yum-y install caching-nameserver *

3. modify the configuration file

(1) enter the configuration file

CD/var/named/chroot/etc/

 

2-1) ETC/

Named. caching-nameserver.conf

# Access control file

Named. rfc1912.zones

# DNS configuration file

 

2-2) var/

Forward and reverse resolution files of the domain

(2) modify the configuration file

Copy and paste 11 rows from row 21st

Above

(3). Modify the pasted content

Details: domain "lamp.com" is in {

Type master service

Forward parsing file "lamp. Z"; forward and reverse parsing file name can be obtained

Allowed Users {none };

}

The scope "40.168.192" is in {

Type master service

Reverse parsing file "lamp. F ";

Allowed Users {none}

}

 

4. Modify the access control file

(1) enter the file

(2) replacement characters

: % S/localhost/Any/g

: % S/127.0.0.1/Any/g

 

Complete File

 

5. Create a forward resolution file for the domain

(1) enter the Directory

(2) copy an object

(3). Replace the file

: % S/localhost/lamp.com/g

(4). Modify the file

 

6. Create a reverse resolution file for the domain

(1). Copy an object

Cplamp. Z lamp. f

(2). Enter the file

(3) modify the reverse resolution File

 

7. Modify permissions

Chown: named cdlamp *

 

8. Change the IP address path

 

9. Restart the service

If this step is not started successfully, the lamp. Z or lamp. f configuration is incorrect!

 

Build the primary DNS server. Now test

 

 

 

Test in window

Primary DNS test successful!

 

Build a slave DNS Service

1. clone a virtual machine that has built a lamp Environment

2. Change the IP address

3. modify the configuration file

Enter the Directory

Enter File

 

Copy and paste 11 rows from row 21st

Above

 

Modification result:

Masters is followed by the IP address of the primary DNS

Note: The Reverse/forward file is stored in the salaves directory.

 

(4). Modify the control file

: % S/localhost/Any/g

: % S/127.0.0.1/Any/g

Complete file content:

 

(5) modify the forward resolution File

Go to the directory CD/var/named/chroot/var/named/slaves

VI lamp. Z

(6) Modify reverse files

 

 

 

 

7. Modify permissions

Chown: named lamp *

 

8. Change the IP address path

 

9. Restart the service

If this step is not started successfully, the lamp. Z or lamp. f configuration is incorrect!

 

10. view files

These three files indicate that the DNS service is successfully created.

 

Test now

 

 

 

Test in window

Change local DNS

Disable server Nic connection

 

 

Test from DNS server successful

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.