Static DNS configuration Linux

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/ximenjianxue/article/details/100573437

Background Description

DNS is the Domain Name System, DNS server can be divided into three types, cache servers (Cache-only server), the primary server (Primary Name server), the secondary server (Second Name Server). Linux general use of the local DNS local static static resolution specified file /etc/resolv.conf dns server is implemented; the Internet to collect some open DNS address, we can refer to use:
DNS number of users Country State regional operational commercial households rankings (province) the ratio of the number of users (province)
112.4.0.55 1.1119 million China mobile Shaanxi Xi'an 9.84% 5
221.131.143.69 1.0221 million China Xuzhou, Jiangsu mobile 5.17% 4
211.138.106.2 633 600 China mobile Shanxi Luliang 6.79% 6
211.138.106.7 617 700 China Shanxi Yuncheng mobile 7 6.62%
218.201.96.130 594700 China Yantai, Shandong mobile 2.54% 6
211.137.191.26 582.7 thousand, Jinan, Shandong, China mobile 2.49% 7
211.140.13.188 476400 Hangzhou, Zhejiang, China mobile 2.16% 16
211.140.188.188 404.2 thousand Zhoushan, Zhejiang, China mobile 1.84% 19
211.136.17.107 401.8 thousand Chinese Hubei Jingzhou mobile 2.98% 5
211.141.90.68 298 200 China Ganzhou, Jiangxi mobile 4 3.91%
211.141.85.68 262300 China Nanchang, Jiangxi Mobile 3.44% 5
221.130.13.133 Nanjing, Jiangsu 259000 China Mobile 1.31% 8
211.136.20.203 189.8 thousand Xianning China Mobile 1.41% 9
211.137.82.4 11700 Sichuan, China Mobile 0.12% unknown 28
211.138.180.2 Anhui 176000 China Huaibei moved 1.66% 7
211.137.130.19 168500 Shaanxi China mobile 1.49% 10
211.137.130.3 163 300 China mobile Shaanxi Xi'an 1.44% 11
221.179.38.7 135 900 in Chongqing, China mobile 1.75% 6
211.138.30.66 128000 Beijing China mobile 1.11% 10
218.201.4.3 124.3 thousand Chongqing, China mobile 1.60% 7
211.136.192.6 China Guangdong mobile 119 700 0.21% 27
211.137.82.4 111000 unknown unknown unknown mobile 1.74% 3
218.201.21.132 95500 Chongqing, China mobile 1.23% 8
211.139.5.29 93200 China Guiyang, Guizhou mobile 6 1.96%
211.138. 245.180 92400 Guangxi, China mobile 1.03% 7
211.138.151.161 91600 China Fuzhou, Fujian mobile 7 0.69%
211.136.17.108 90400 Nanning, Guangxi, China Mobile 1.01% 8
211.139.5.30 89100 China Guiyang, Guizhou Mobile 1.87% 7
221.130.162.223 84400 Anqing, Anhui, China Mobile 0.80% 8
211.137.32.178 73400 China Shenyang, Liaoning Mobile 0.55% 6
211.138.91.1 72000 Inner Mongolia, China 1.35% Bayannaoer mobile 7
211.142.210.100 69500 Xiangtan, Hunan, China mobile 0.58% 12
218.202.152.130 68700 Urumqi, Xinjiang, China mobile 1.65% 7
211.138.180.3 63200 Huaibei, Anhui, China mobile 0.60% 9
218.207.128.4 Quanzhou, Fujian, China mobile 60200 10 0.46 %
211.138.200.69 60100 Changzhou, Jiangsu, China mobile (the province's share) 12 0.30%
211.138.13.66 58800 Handan China mobile 0.30% 6
211.136.112.50 55300 Shanghai China mobile 0.58% 19
211.142.210.99 Changsha, Hunan, China mobile 51100 19 0.42%
211.137 .58.20 46600 Wuhan, China mobile 0.35% 18
211.136.150.66 Shanghai China mobile 42700 21 0.45%
218.203.160.194 42400 China Lanzhou, Gansu Mobile 1.25% 7
221.130.33.60 42300 Beijing, China Mobile 0.37% 17
211.138.91.2 40900 Hohhot, Inner Mongolia, China Mobile 0.77% 9
211.142.210.98 39700 Zhuzhou, Hunan, China Mobile 0.33% 23
221.130.33.52 38700 Beijing China Mobile 0.34% 20
218.201.124.18 38700 Zibo, Shandong, China mobile 0.17% 12
218.201.124.19 38700 Zibo, Shandong, China mobile 0.17% 13
120.196.165.7 unknown 36500 China mobile 9.18% 4
211.103.13.101 34900 Wuxi, Jiangsu, China mobile 0.18% 17
218.203.160.195 33200 China Lanzhou, Gansu mobile 0.98% 8
211.138.156.66 33000 Fuzhou, Fujian, China mobile 0.25% 15
218.207.217.242 32400 Fuzhou, Fujian, China mobile 0.25% 16
211.142.210.101 31900 Yueyang, Hunan, China mobile 0.26% 29
211.136.20.204 China Guangzhou, Guangdong mobile 29500 47 0.05 %
211.143.60.56 28500 China Shijiazhuang, Hebei mobile 8 0.15%
218.207.217.241 27200 Fuzhou, Fujian, China Mobile 0.21% 21
211.143.181.178 26300 Fuzhou, Fujian, China Mobile 0.20% 24-
211.141.16.99 23800 Jilin, China Mobile 0.19% 11
211.138.106.3 22900 Shanxi, China Mobile 0.25% 9
211.137.64.163 22200 Wuhan, China Mobile 0.16% 24-
218.207.130.118 Quanzhou, Fujian, China mobile 20600 0.16% 28
211.141.90.69 20500 Nanchang, Jiangxi China mobile 0.27% 14
218.202.1.166 19600 Zhaotong in Yunnan, China mobile 0.40% 8
211.137.160.5 18700 Tianjin, China mobile 0.47% 10
211.140.10.2 of 18,000 Jinhua, Zhejiang, China mobile 0.08% 58
211.138.242.18 16900 Nanning, Guangxi, China mobile 0.19% 13
211.136.18.171 14100 Shenzhen, Guangdong, China mobile 0.02% 79
211.138.106.19 13900 Shanxi, China mobile 0.15% 12
211.139.29.68 Yunnan, China mobile 13300 11 0.27%
211.137 .241.34 12300 China Harbin, Heilongjiang mobile 14 0.14%
Mobile China Harbin 211.137.241.35 11700 0.14% 16
211.139.163.6 Guangdong China Mobile 11400 (common province) 0.02 97%
211.138.106.18 Shanxi 11100 0.12% China Mobile 13 is
221.176.88.95 11000 Haikou China Mobile 0.55%. 8
211.141.0.99 10400 China Jilin mobile 0.08% 15
221.130.56.241 10300 Wuxi, Jiangsu, China mobile 0.05% 45
218.202.152.131 10000 Urumqi, Xinjiang, China mobile 0.24% 15
211.143.181.179 9900 China Fuzhou, Fujian mobile 0.08% 41
218.201.17.2 9000 China Chongqing mobile 41 0.12 %
211.138.75.123 8300 China Xining 0.94% mobile 5
218.200.6.139 7600 Xi'an China mobile 0.07% 43
211.136.28.234 7500 Beijing China mobile 0.07% 69
211.136.28.231 7200 Beijing China mobile 0.06% 71
211.139.136.68 7000 China Guangdong mobile 0.01% 129
211.136.28.237 6900 Beijing China mobile 0.06% 74
111.8.33.250 6200 7 1.56% China mobile unknown
211.136.28.228 6100 Beijing China Mobile 0.05% 85
221.130.32.100 5400 Beijing China Mobile 0.05% 92
221.130.32.106 5100 Beijing China Mobile 0.04% 97
221.130.32.109 5100 Beijing China Mobile 0.04% 96
211.139.73.34 5000 8 0.14 China Mobile Lhasa %
211.138.164.6 Haikou 4900 China mobile 0.24% 12 is
211.140.197.58 4700 Dalian, Liaoning, China mobile 0.04% 37 [
221.179.35.81 4700 Chongqing China mobile 0.06% 50
211.103.55.50 Suzhou Jiangsu, China mobile 4700 0.02% 72
211.137.160.185 Tianjin, China 4500 mobile 0.11% 26
221.130.32.103 4400 Beijing China mobile 0.04% 105
211.139.73.35 4300 in Lhasa, Tibet China mobile 0.12% 9
211.142.236.87 3700 China mobile Hunan Zhuzhou 65 0.03%
over the DNS information reproduced in http://avzz.cn/wwzt /2018-06-16/243.html

DNS Review

DNS server data flow architecture overview:
Here Insert Picture Description

Dns query ways:

Recursive query: host to a local domain name server are generally used recursive query query results are returned to the local server host, issued only one request.
Iterative query: the local domain name server iterative queries to root name server queries, issuing many requests, finally returned by the end dns server directly to the client.

DNS software deployment structure

Here Insert Picture Description
As shown above, in the Linux DNS function is implemented through bind software using TCP / UDP 53 ports. After bind software installation, will have several inherent document, is divided into two categories, one is a configuration file in the / etc directory, a file record type is dns at / var / named directory. Together with other relevant documents, jointly set up dns server.

Common Profile Description

/etc/named.conf ## DNS master profile
Reference Example:
Here Insert Picture Description
/etc/rndc.key key profile ##
/var/named/*.zone ## zone data files, particularly files copied from the template to generate a custom after all the designated DNS data files are stored in this directory, sub-forward / reverse lookup file, directory file named.localhost to forward resolution template;
configuration:
Here Insert Picture Description
reverse zone configuration:
Zone "0.0.127.in -addr.arpa "{
type master;
file" 0.0.127.in-addr.arpa.zone ";
}; ## converts designated named as master server network address 127.0.0, named.local file contains 127.0. 0. * convert data in the form of address to the domain name (127.0.0 segment address is the LAN address of the internal loopback interface);
Zone "localhost" {
type Master;
File "localhost.zone";
}; designated ### comprising localhost the file data is stored in the DNS in /var/named/localhost.zone;
Zone "ruoheng.com" {
type Master;
Notify Yes;
file "ruoheng.com.zone";
}; field ### indicates that the above statement 21php.com DNS data stored in / var / named / directory in ruoheng.com.zone;

Open the zone data files: vim /var/named/ruoheng.com.zone, as follows:
Here Insert Picture Description
Legend Caption:
$ the TTL 1D
@ @ the IN admin.ruoheng.com the SOA (.
0; version sequence number Serial # ------
1D; refresh ------ # refresh time, looking for master synchronization
1H; retry ------ # retry the connection
1W; expire ------ # maximum endurance time
3H); minimum --- --- # cache holding up to three hours
NS @ ------ # server name
a 192.168.120.5 ------ # host server's address
iN MX 5 ruoheng.com. ------ # mail exchange record
mail iN a 192.168.120.5 ------ # forward resolution mailbox address
www iN a 192.168.120.100 ------ # hostname resolution
smtp iN CNAME mail.ruoheng.com --- --- # alias resolution
IN A 8.8.8.8 ------ # Pan DNS

/etc/resolve.conf ## local DNS resolver, specify the remote DNS server addresses, and hosts file can be specified as a static DNS server domain name resolution.
Format:
Domain lookup default domain
nameserver address specified DNS

Command: named-checkzone "area name" area data file -------> Check the configuration file is correct

Guess you like

Origin blog.csdn.net/ximenjianxue/article/details/100573437