Set up the DNS service in linux and set up the linuxdns Service

Source: Internet
Author: User
Tags reverse dns

Set up the DNS service in linux and set up the linuxdns Service

I will not elaborate on the theoretical knowledge too much here.

Need to Know: http://baike.baidu.com/subview/22276/15346050.htm? Fr = aladdin

Go to build

Software used: Vmware workstation 10 rhel6.3 (64-bit)

Operating system used:

[Root @ wang ~] # Uname-

Linux wang 2.6.32-279. el6.x86 _ 64 #1 SMP Wed Jun 13 18:24:36 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux

First, mount the image

[Root @ wang ~] # Mount/dev/cdrom/opt/

Then configure yum. By default, the yum package has been installed.

Configure local yum source now

[Root @ wang ~] # Cd/etc/yum. repos. d/

[Root @ wang yum. repos. d] # ls

Rhel-source.repo

[Root @ wang yum. repos. d] # vi rhel-source.repo

Save and exit

Use yum list for testing

[Root @ wang yum. repos. d] # yum list

Use yum to install the main DNS package bind

[Root @ wang yum. repos. d] # yum install bind-*-y

Next, modify the configuration file.

[Root @ wang ~] # Vi/etc/named. conf

Check file correctness

[Root @ wang ~] # Named-checkconf/etc/named. conf

[Root @ wang ~] #

Next we will talk about copying the/var/named file to the chroot directory. chroot is developed as a DNS security consideration and serves as a confusing attacker.

 

[Root @ wang ~] # Cd/var/named/

[Root @ wang named] #

[Root @ wang named] # ls

Chroot data dynamic named. ca named. empty named. localhost named. loopback slaves

[Root @ wang named] #

[Root @ wang named] #

[Root @ wang named] # cp named. */var/named/chroot/var/named/

[Root @ wang named] #

Do not confuse the chroot named directory with the previous one.

[Root @ wang named] # pwd

/Var/named/chroot/var/named

[Root @ wang named] # ls

Named. ca named. empty named. localhost named. loopback

Create forward and reverse DNS resolution files

[Root @ wang named] # cp named. empty wang. zone

[Root @ wang named] #

[Root @ wang named] #

[Root @ wang named] # ls

Named. ca named. empty named. localhost named. loopback wang. zone

[Root @ wang named] #

[Root @ wang named] #

[Root @ wang named] # cp named. empty rewang. zone

Here named. empty is the Template File

Modify forward resolution File

[Root @ wang named] # vi wang. zone

Modify reverse resolution File

[Root @ wang named] # vi rewang. zone

Check whether the configured forward file is faulty.

[Root @ wang named] # named-checkzone wang.com/var/named/chroot/var/named/wang. zone

Zone wang.com/IN: loaded serial 0

OK

[Root @ wang named] #

Change the root group in var to the named group.

Original:

[Root @ wang named] # ll

Total 24

-Rw-r -----. 1 root 1892 Dec 5 12:24 named. ca

-Rw-r -----. 1 root 152 Dec 5 12:24 named. empty

-Rw-r -----. 1 root 152 Dec 5 12:24 named. localhost

-Rw-r -----. 1 root 168 Dec 5 nam24 named. loopback

-Rw-r -----. 1 root 189 Dec 5 12:42 rewang. zone

-Rw-r -----. 1 root 185 Dec 5 12:35 wang. zone

After modification:

[Root @ wang named] # chown-R named/var/named/chroot/

[Root @ wang named] # ll

Total 24

-Rw-r -----. 1 named root 1892 Dec 5 named. ca

-Rw-r -----. 1 named root 152 Dec 5 named. empty

-Rw-r -----. 1 named root 152 Dec 5 named. localhost

-Rw-r -----. 1 named root 168 Dec 5 named. loopback

-Rw-r -----. 1 named root 189 Dec 5 rewang. zone

-Rw-r -----. 1 named root 185 Dec 5 wang. zone

[Root @ wang named] #

Start the service next, but sometimes the following problems may occur:

. Generating/etc/rndc. key: stuck here when DNS is started

[Root @ RedHat named] #/etc/init. d/named restart

Stopping named: [OK]

Generating/etc/rndc. key:

^ C

[Root @ redhat named] #


Solution:

[Root @ redhat named] # rndc-confgen-r/dev/urandom-

Wrote key file "/etc/rndc. key"

[Root @ redhat named] #/etc/init. d/named restart

Stopping named: [OK]

Starting named: [OK]

Next, test

Modify the reslov File

[Root @ wang named] # vi/etc/resolv. conf

Add

Search www.wang.com

Nameserver 10.10.39.183

Save and exit.


Then ping

So far, the DNS master configuration is complete. please correct me if you have any shortcomings.

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.