Centos 6.5 DNS Configuration

Source: Internet
Author: User
Tags dns2 nslookup command

Centos 6.5 DNS Configuration

In any operation, a domain name has at least two DNS servers. One is called a Primary Domain Name Server, and the other is called a secondary Domain Name Server. These servers are usually used for failover: If one server goes down and the other is activated as a DNS server (in fact, two or more DNS servers work together, not after the first server stops the service, the second server takes over. The parser randomly selects a DNS server for inquiry. If it times out, it will ask the next one. This is the fault tolerance mechanism of multiple DNS servers ). It can also implement more complex failover mechanisms, including load balancing, firewalls, and clusters.

Preparations: VMware 10 Environment

1. Two Centos6.5x64 bits, minimum installation system

2. primary IP Address: 192.168.171.100 secondary IP Address: 192.168.171.101

3. Host Name: DNS1 sub-Host Name: DNS2

4. Install the Ntpdate service and set timed synchronization to Beijing time. (This has nothing to do with DNS service configuration. I am used to it .)

1. Modify and configure a fixed IP Address

[Root @ localhost ~] # Cat/etc/sysconfig/network-scripts/ifcfg-eth2

DEVICE = eth2

HWADDR = 00: 0C: 29: 82: CD: 56 # The default MAC is different from the configuration. Set it to the default MAC to access the Internet!

TYPE = Ethernet

UUID = b3569904-adf0-43d7-a925-b71ae106dcb6

ONBOOT = yes # enable the device

NM_CONTROLLED = yes

# BOOTPROTO = dhcp # enable static IP

IPADDR = 192.168.171.100

NETMASK = 255.255.255.0

GATEWAY = 192.168.171.2

DNS1 = 192.168.171.10

DNS2 = 192.168.171.2

Restart the network service:

[Root @ localhost ~] # Service network restart

Ii. Modify the Host Name

[Root @ localhost ~] # Cat/etc/sysconfig/network

NETWORKING = yes

HOSTNAME = DNS1

Restart the computer to make the modified host name take effect

[Root @ localhost ~] # Init 6

3. Install the Ntpdate service and synchronize it with Beijing time.

[Root @ DNS1 ~] # Yum-y install ntpdate

Create scheduled task

[Root @ DNS1 ~] # Crontab-e

Add the following content, that is, synchronize every 2 minutes. Save and exit!

0-59/2 ****/usr/sbin/ntpdate us.pool.ntp.org | logger-t NTP

4. Start to install and configure the DNS Service: bind

[Root @ DNS1 ~] # Yum-y install bind

After installation, the main configuration file path is/etc/named. conf.

The path of the region configuration file is/var/named/Note: the corresponding region file needs to be created.

1. In the bind main configuration file named. conf

Change 127.0.0.1 to the local IP address listen-on port 53 {192.168.171.100 ;};

Change localhost to the desired CIDR Block, such as allow-query {192.168.171.0/24 ;};

Save and exit!

2. Create the zone file for this domain in/etc/named. rfc1912.zones, and delete the original zone option before creation.

Zone "china.com" IN {# create a domain: china.com

Type master;

File "china.com. zone"; # corresponding domain file

Allow-update {none ;};

};

Zone "171.168.192.in-addr. arpa" IN {

Type master;

File "171.168.192.zone ";

Allow-update {none ;};

};

3. Create a domain file, edit the zone file, and add required information.

Cp/var/named. localhost/var/named/china.com. zone

Cp

Add the corresponding entries in the two files as follows:

[Root @ DNS1 named] # cat china.com. zone

$ TTL 1D

@ IN SOAdns1.china.com. root (

0; serial

1D; refresh

1 H; retry

1 W; expire

3 H); minimum

@ INNSdns1.china.com.

Dns1 INA192.168.171.100

Wsus INA192.168.171.131

[Root @ DNS1 named] # cat 171.168.192.zone

$ TTL 1D

@ IN SOAdns1.china.com. root (

0; serial

1D; refresh

1 H; retry

1 W; expire

3 H); minimum

@ INNSdns1.china.com.

100INPTRdns1.china.com.

131 INPTRwsus.china.com.

Pay attention to the following points after com; otherwise, an error is reported!

4. Start the bind Service

Service named start or/etc/init. d/named start

5. Run the host or nslookup command to check whether the domain information is normal.

[Root @ DNS1 ~] # Host dns1.china.com # Forward Interpretation

Dns1.china.com has address 192.168.171.100

[Root @ DNS1 ~] # Host 192.168.171.100 # reverse Interpretation

100.171.168.192.in-addr. arpa domain name pointer dns1.china.com.

6. Test on the client wsus and prompt that the server cannot be found. For example:

7. Disable the firewall iptables. The explanation is normal.

---------------------------------- Master DNS configuration is completed ------------------------------------------

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.