Learn 12 DNS configurations with me in linux (I)

Source: Internet
Author: User
Tags domain server nslookup
I learned 12 DNS configuration (I) together with linux-Linux Enterprise Application-Linux server application information. The following is a detailed description. Dns Server Setup 1
In the past two days, the company's own movie server crashed, so it took a lot of time. I hope you will continue to support me.
Let's start learning today.
1. First, go to www.isc.org to download the latest dns version.
[Root @ zy jishu] # tar zxvf bind-9.2.4.tar.gz decompress and modify the file
[Root @ zy jishu] # cd bind-9.2.4 go to the Change directory
[Root @ zy bind-9.2.4] #./configure -- help to view help
[Root @ zy bind-9.2.4] #./configure -- sysconfdir =/etc put the main configuration 2. Put the file directory under the etc directory for ease of Management
[Root @ zy bind-9.2.4] # make
[Root @ zy bind-9.2.4] # make install
[Root @ zy bind-9.2.4] # ls/usr/local/bin view application installation location dig host isc-config.sh nslookup nsupdate vnc
[Root @ zy bind-9.2.4] # ls/usr/local/sbin server program location
3. [root @ zy bind-9.2.4] # vi/etc/named. conf
We will first set up the root server
Options {
Directory "/var/named"; working directory
};
Zone "."{
Type hint; root server type
File "named. ca"; file used
};
Wq
The configuration file of the root server is stored in/var/named.
[Root @ zy bind-9.2.4] # create the directory mkdir/var/named
We also need to create a Root Domain Server File named. ca
But now we do not know the address of the root domain server. We need to find the address of the root domain server.
[1] vi/etc/resolv. conf first in resolv. fill in any available dns server address in the conf file. You can find ipconfig/all in the windows network neighbor or ifconfig/all on the linux server.
Nameserver 202.96.209.134
Write it into this file. The command is
[Root @ zy bind-9.2.4] # echo "namesercer 202.96.209.134">/etc/resolv. conf
[2] [root @ zy bind-9.2.4] # dig-t NS.>/var/named. ca
Redirects the search result to named. ca.
[3] First modify vi/etc/resolv. conf to replace the address with our local host nameserver 127.0.0.1
Then start the dns server [root @ zy bind-9.2.4] # named
[Root @ zy bind-9.2.4] # tail/var/log/messages check if any errors are found during startup.
[Root @ zy bind-9.2.4] # ps-aux | grep named check whether the process is running
[Root @ zy bind-9.2.4] # The host www.sina.com test shows that the local dns can work.
Now let's add a little bit about the dns control tool rndc.
[Root @ zy bind-9.2.4] # rndc-confgen>/etc/rndc. the result of running rndc-confgen in conf is that the control tool redirects it to/etc/rndc. conf facilitates the management of [root @ zy bind-9.2.4] # more/etc/rndc. conf to view the file, you will find the following sentence, it means to put the following content in named. conf
Use with the following in named. conf, adjusting the allow list as needed:
[Root @ zy etc] # cat-n/etc/rndc. conf check the specific number of lines and find that the number of lines to be added is
[Root @ zy etc] # tail + 13/etc/rndc. conf>/etc/named. conf. We append 13 rows to named. conf.
[Root @ zy etc] # vi/etc/named. conf and comment out the # before the 13 rows we just added
[Root @ zy etc] # killall-9 named kills the previous named Process
[Root @ zy bind-9.2.4] # Start named again. You can use service named restart.
[Root @ zy bind-9.2.4] # Check the server status by rndc status
[Root @ zy bind-9.2.4] # Check tail/var/log/messages if any errors occur.
Next, let's talk about creating a local localhost zone.
[1] [root @ zy root] # more/etc/hosts we can see the definition of localhost, using the 127.0.0.1 address, the local loopback address of any host
127.0.0.1 localhost. localdomain localhost
[Root @ zy root] # vi/etc/named. conf. Modify named. conf and add the localhost area to the end.

Zone "localhost "{
Type master; master is the primary domain, which means the server is managed by the computer.
File "named. local"; file used
};
[2] Then we will create a file named. local under/var/named.
[Root @ zy root] # cd/var/named/
[Root @ zy root] # vi named. local
$ TTL 1D the global variable is one day. You can remove the following 1D.
@ 1D in soa localhost. root. localhost .(
20070731
1 H
15 M
1 W
1D)
In ns localhost.
In a 127.0.0.1
@ Refers to the localhost zone name, IN refers to the type here refers to the Internet type, SOA refers to the record type, refers to the address type or server, or file exchange, etc. It is followed by localhost. it refers to the SOA. This record type serves the region, that is, the current domain name, root. locahost. it is the manager information of this zone. 20070731 refers to the Update time of this domain, and 1 H refers to the refresh of the following Domain Name Server records within one hour, 15 M is a problem between the slave server and the master server. It sends a request every 15 minutes. If repeated retries fail, the previous 1 W will expire in one week, and the cache time is 1D or one day, that is, the server records the file for one day, A is the address to specify the address of this server, and NS is the service type followed by 127.0.0.1, which is the address of our own dns server.
[3] [root @ zy named] # service named restart
[Root @ zy named] # dig localhost test, you can also use host or nslookup
Now we will add a normal zone zhaoyong.com. First, we will establish a forward resolution
[1]. [root @ zy bind-9.2.4] # Add the following content to the vi/etc/named. conf file:

Zone "zhaoyong.com" {added zhaoyong.com.
Type master; type master domain
File "zhaoyong.com. zone"; the configuration file is zhaoyong.com. zone.
};
Wq
The configuration file zhaoyong.com. zone can actually be named at will. Here we set this name to make it easier to remember.
Then we need to go to the/var/named working directory to create and modify zhaoyong.com. zone.
[Root @ zy named] # cd/var/named
[Root @ zy named] # vi zhaoyong.com. zone to create this file
$ TTL 1D the global variable is one day. You can remove the following 1D.
@ 1D in soa zhaoyong.com. root.zhaoyong.com .(
20070731
1 H
15 M
1 W
1D)
In ns zy.zhaoyong.com. Who is the current server host? zy.zhaoyong.com.
In mx mail.zhaoyong.com.
Zy in a 192.168.1.144
Www in a 192.168.1.102
Mail in a 192.168.1.101
News in cname www
[2] [root @ zy named] # vi/etc/sysconfig/network; give the local host a name,
NETWORKING = yes
HOSTNAME = zy.zhaoyong.com
[3] [root @ zy named] # vi/etc/hosts; for local resolution, both the host name and IP address can be written in, which can improve the resolution speed.
127.0.0.1 localhost. localdomain localhost
192.168.1.144 zy.zhaoyong.com
[4] [root @ zy named] # more/etc/host. conf resolution sequence. The above hosts cannot be parsed, so the DNS resolution will be completed.
Order hosts, bind
I will introduce several parameters IN detail. @ refers to the Zone name zhaoyong.com, IN refers to the type. Here it refers to the Internet type, and SOA refers to the record type, indicates whether this type is address or server, or file exchange. It is followed by zhaoyong.com. it refers to the SOA. This record type serves the region, that is, the current domain name, root.zhaoyong.com. it is the manager information of this zone. 20070731 refers to the Update time of this domain, and 1 H refers to the refresh of the following Domain Name Server records within one hour, 15 M is a problem between the slave server and the master server. It sends a request every 15 minutes. If repeated retries fail, the previous 1 W will expire in one week, and the cache time is 1D or one day, that is, the server records the file for one day, A is the address to specify the address of this server, NS is the service type, followed by the address 192.168.1.144 is the address of our own dns server, 192.168.1.102 is the www address, CNAME is an alias, that is, it also changes when the address of the www host changes.

[5] [root @ zy named] # service named restart
[Root @ zy named] # dig www.zhaoyony.com succeeded
[Root @ zy named] # host news.zhaoyong.com failed
[Root @ zy named] # vi/etc/resolv. conf
Search zhaoyong.com so that it will first search for
[Root @ zy named] # host news.zhaoyong.com is successfully tested again
I can't finish writing it today. I will upload it first. Tomorrow I will continue to hope that my friends will support me. I will try my best.
Next, we will focus on the configuration of reverse regions and secondary domain name servers,
Here is another qq 754812411 beauty of Wenzhou beauty. I will study linxu again.
What can we do if we don't learn it well?
Related Article

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.