DNS in 04-linux (i)

Source: Internet
Author: User
Tags nslookup

0, on the configuration of Linux under the DNS of some of the terms of the explanation, see the article "03-about the configuration of the DNS under Linux explanation of some nouns (transferred from the network)" self-learning
First, about the DNS configuration file
To view the DNS configuration file:

rpm -lq bind

When you enter, you will get the following (excerpt):

……/etc/named.conf #主配置文件设置DNS服务器的属性/etc/named.iscdlv.key/etc/named.rfc1912.zones #DNS 服务器的区域定义配置文件(存储正向查找区的区域设置)/etc/named.root.key……/var/named #区域文件所在的目录(主机记录)/var/named/data #可以创建相应的区域文件来存储相应的主机记录/var/named/dynamic/var/named/named.ca #使用cat命令可查看Internet上根DNS服务器/var/named/named.empty……

Second, build the enterprise intranet DNS server scene
1. Resolve intranet Server domain name
Example: Want to let enterprise employees use domain name to access mail server, OA system, FTP, etc. (these servers are private network address)
2, reduce the network domain name resolution traffic
Example: Caching to local DNS can reduce DNS resolution traffic, or restrict corporate employees to other sites
Third, create a forward region (domain name →IP address, to resolve zhangyujia.cn as an example)
1. Edit the file

vi /etc/named.rfc1912.zones

2. Define the forward lookup zone

[named.rfc1912.zones]zone “zhangyujia.cn” IN {type master; #主区域file “named.zhangyujia.cn”; #区域文件名称allow-update { none; }; #允许不允许客户端更新这个区域文件?(不允许)};

3. Create a new zone file (here's the parameter if you don't understand it, see the article "03-explanation of some nouns in DNS for configuring Linux (go from the network)" self-learning)

vi /var/named/named.zhangyujia.cn[named.zhangyujia.cn]$TTL 1Dzhangyujia.cn. IN SOA webserver.zhangyujia.cn. [email protected](0 ;serial1D ;refresh1H ;retry1W ;expire3H ;minium);zhangyujia.cn. IN NS webserver.zhangyujia.cn.zhangyujia.cn. MX 10 mailwebserver IN A 192.168.80.100www IN A 192.168.80.100ftp IN A 192.168.80.100mail IN A 192.168.80.100smtp IN CNAME mailwww IN TXT “This is a web”

The equivalence notation @ represents the region itself zhangyujia.cn.

[named.zhangyujia.cn]$TTL 1D@ IN SOA webserver.zhangyujia.cn. zhangyj_public.163.com. (0 ;serial1D ;refresh1H ;retry1W ;expire3H ;minimum);IN NS webserver.zhangyujia.cn.IN MX 10 mailwebserver IN A 192.168.80.100www IN A 192.168.80.100ftp IN A 192.168.80.100mail IN A 192.168.80.100smtp IN CNAME mailwww IN TXT “This is a web”

4, Save the file, check whether there is named.zhangyujia.cn wrong place

:wqnamed-checkzone zhangyujia.cn /var/named/named.zhangyujia.cn

5, restart the service, so that the named.zhangyujia.cn start effective

service named restart

Iv. Creating the Reverse zone (IP address → domain name)
Take the 131.107.8.X segment as an example, the reverse region name 8.107.131.in-addr.arpa
1. Edit the file

vi /etc/named.rfc1912.zones

2, define the reverse lookup zone (here parameters if you do not understand the place see the article "03-about the configuration of the DNS under Linux in the explanation of some nouns (transferred from the network)" self-learning)

[named.rfc1912.zones]zone “8.107.131.in-addr.arpa” IN {type master; #主区域file “named.8.107.131”; #区域文件名称allow-update { none; }; #允许不允许客户端更新这个区域文件?(不允许)};

3. Create a zone file

vi /var/named/named.8.107.131[named.8.107.131]$TTL 1D@ IN SOA webserver.zhangyujia.cn. zhangyj_public.163.com.(0 ;serial1D ;refresh1H ;retry1W ;expire3H ;minimum);@ IN NS webserver.zhangyujia.cn.222 IN PTR www.51cto.com.111 IN PTR blog.51cto.com.

4. Restart Service

service named restart

Testing domain name resolution on Windows, using Nslookup

Nslookup
Set Type=a
www.zhangyujia.cn
Set TYPE=MX
zhangyujia.cn
Set Type=txt
www.zhangyujia.cn
Set Type=ns
zhangyujia.cn
Set Type=soa
zhangyujia.cn
Set Type=ptr
131.107.8.222
131.107.8.111
Exit

(not to be continued ...) )

Welcome attention
Sina Weibo: https://weibo.com/yougazhang0506
Public platform: Zhang Yujia

My site: http://www.zhangyujia.cn
51CTO Blog: http://blog.51cto.com/11099293

DNS in 04-linux (i)

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.