{"id":196827,"date":"2020-08-04T09:48:35","date_gmt":"2020-08-04T01:48:35","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=196827"},"modified":"2020-07-24T08:49:40","modified_gmt":"2020-07-24T00:49:40","slug":"linux-dns","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-dns.html","title":{"rendered":"linux\u5b9e\u73b0DNS\u8f6e\u8be2\u5b9e\u73b0\u8d1f\u8f7d\u5e73\u8861"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nDNS \u8f6e\u8be2\u673a\u5236\u4f1a\u53d7\u5230\u591a\u65b9\u9762\u7684\u5f71\u54cd\uff0c\u5982\uff1aA\u8bb0\u5f55\u7684TTL\u65f6\u95f4\u957f\u77ed\u7684\u5f71\u54cd\uff1b\u522b\u7684 DNS \u670d\u52a1\u5668 Cache \u7684\u5f71\u54cd\uff1bwindows \u5ba2\u6237\u7aef\u4e5f\u6709\u4e00\u4e2aDNS Cache\u3002\u8fd9\u4e9b\u90fd\u4f1a\u5f71\u54cd DNS \u8f6e\u8be2\u7684\u6548\u679c\u3002\u56e0\u6b64 DNS \u7684\u8f6e\u8be2\u673a\u5236\u5e76\u4e0d\u80fd\u505a\u4e3a\u4e00\u4e2a load balancing\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u53ea\u80fd\u4f5c\u4e3a\u4e00\u4e2a load distribution \u65b9\u6848\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u4e0d\u8fc7\u6709\u4e00\u4e2a\u53c2\u6570\u4f60\u53ef\u4ee5\u8bd5\u8bd5\u770b\u662f\u5426\u80fd\u8c03\u6574\u4e00\u4e0b\u8f6e\u8be2\u7684\u6548\u679c\uff1a
\n\u5728 named.conf \u4e2d\u53ef\u4ee5\u8bbe\u7f6e bind \u7684 round-robin \u7684\u7ed9\u51fa\u7ed3\u679c\u7684\u987a\u5e8f\uff1a<\/p>\n

options {\r\nrrset-order { order random; };\r\n};<\/pre>\n

rrset-order \u652f\u6301\u4e09\u4e2a\u53c2\u6570\uff1afixed, random, cyclic \u3002
\nfix \u4f1a\u5c06\u591a\u4e2aA\u8bb0\u5f55\u6309\u914d\u7f6e\u6587\u4ef6\u7684\u987a\u5e8f\u56fa\u5b9a\u7ed9\u51fa
\nrandom \u4f1a\u968f\u673a\u7ed9\u51fa
\ncyclic \u4f1a\u5faa\u73af\u7ed9\u51fa<\/p>\n

DNS\u8f6e\u8be2\u5c31\u662f\u6307DNS\u670d\u52a1\u5668\u5c06\u57df\u540d\u89e3\u6790\u8bf7\u6c42\u6309\u7167A\u8bb0\u5f55\u7684\u987a\u5e8f\uff0c\u9010\u4e00\u5206\u914d\u5230\u4e0d\u540c\u7684IP\u4e0a\uff0c\u540c\u65f6\u5728\u4e00\u5b9a\u7a0b\u5ea6\u4e0a\u4e5f\u5b9e\u73b0\u4e86\u7b80\u5355\u7684\u8d1f\u8f7d\u5747\u8861\u3002<\/p>\n

\u6211\u4eec\u5148\u770b\u4e00\u4e0b WINDOWS2003\u4e0b\u5982\u4f55\u8bbe\u7f6eDNS\u8f6e\u8be2\u3002\u6bd4\u5982\uff1a\u6709\u4e24\u53f0WEB\u4e3b\u673a\uff0cA\u4e3b\u673aip\u662f 192.168.1.1\uff0cB\u4e3b\u673aip\u662f192.168.1.4 \uff0c \u4f01\u4e1a\u91cc\u6709\u5355\u72ec\u4e00\u53f0DNS\u670d\u52a1\u5668\uff0c\u7136\u540e\u5728\u8be5DNS\u670d\u52a1\u5668\u7684\u6b63\u5411\u533a\u57df\u91cc\uff08\u57df\u540d\u4e3ahaiquan.net\uff09\u5206\u522b\u5efa\u7acb\u4e24\u4e2a\u4e3b\u673aA\u8bb0\u5f55\uff0c\u7b2c\u4e00\u4e2a\u4e3b\u673a\u8bb0\u5f55\u7684\u8bb0\u5f55IP\u662f 192.168.1.1\uff0c \u7b2c\u4e8c\u4e2a\u4e3b\u673a\u8bb0\u5f55\u7684\u8bb0\u5f55IP\u662f192.168.1.4\uff0c\u9644\u56fe\uff1a
\n\"\"
\n\u8f6c\uff1alinux\u5b9e\u73b0DNS\u8f6e\u8be2\u5b9e\u73b0\u8d1f\u8f7d\u5e73\u8861<\/p>\n

\u7136\u540e\u5728DNS\u4e3b\u673aQINGYG\u4e0a\u70b9\u51fb\u53f3\u952e\u9009\u62e9\u5c5e\u6027\uff0c\u5728\u51fa\u73b0\u7684\u5bf9\u8bdd\u6846\u4e2d\u52fe\u9009\"\u542f\u7528\u5faa\u73af\"\uff0c\u5982\u56fe\uff1a
\n\"\"<\/p>\n

\u6ce8\u610f\uff1a\u7f51\u7edc\u63a9\u7801\u6392\u5e8f\u53ef\u4ee5\u6839\u636e\u5b50\u7f51\u63a9\u7801\u6765\u5224\u65addns\u5730\u5740\u548c\u5ba2\u6237\u7aef\u662f\u5426\u5728\u540c\u4e00\u4e2a\u7f51\u6bb5\u6216\u8005\u79bb\u7684\u6bd4\u8f83\u8fd1\uff0c\u7136\u540e\u4f18\u5148\u8fd4\u56de\u8f83\u8fd1\u7684\u670d\u52a1\u5668\u7684\u5730\u5740\u3002<\/p>\n

\u8bbe\u7f6e\u5b8c\u6bd5\u540e\uff0c\u6211\u4eec\u770b\u4e00\u4e0b\u6548\u679c\uff1a
\n\"\"<\/p>\n

\u6ce8\u610f\uff1aWINDOWS\u4f1a\u7f13\u5b58DNS\u7ed3\u679c\uff0c\u4e3a\u65b9\u4fbf\u89c2\u5bdf\u8f6e\u8be2\u60c5\u51b5\uff0c\u6211\u4eec\u9700\u8981\u7528\"ipconfig \/flushdns\"\u6765\u6e05\u7a7aDNS\u7f13\u5b58\u3002<\/p>\n

\u4e0b\u9762\u6211\u4eec\u770b\u4e00\u4e0bLINUX\u4e0b\u5982\u4f55\u8bbe\u7f6eDNS\u8f6e\u8be2\uff0c\u4ee5RHEL 5\u4e3a\u4f8b\uff1a
\n1\u3001\u9996\u5148\u9700\u8981\u5b89\u88c5BIND\u5e76\u642d\u5efaDNS\u670d\u52a1\u5668\uff08\u5177\u4f53DNS\u642d\u5efa\u8fc7\u7a0b\u8bf7\u53c2\u8003\u76f8\u5173\u8d44\u6599\uff09<\/p>\n

#yum install -y bind* caching-nameserver*<\/pre>\n

\u5b89\u88c5DNS\u670d\u52a1\u5668\u4e00\u822c\u9700\u8981\u5b89\u88c5\u4ee5\u4e0b\u4e09\u4e2a\u6570\u636e\u5305\uff1a<\/p>\n

bind-utils-9.3.3-7.el5 <\/pre>\n

\u67e5\u8be2\u7528<\/p>\n

bind-chroot-9.3.3-7.el5<\/pre>\n

\u5b89\u5168\u673a\u5236<\/p>\n

caching-nameserver-9.3.3-7.el5 <\/pre>\n

\u914d\u7f6e\u6587\u4ef6<\/p>\n

2\u3001\u4fee\u6539\u533a\u57df\u6570\u636e\u914d\u7f6e\u6587\u4ef6(example.com.db)\uff0c\u8fd9\u91cc\u4e3b\u8981\u770b\u4e00\u4e0bDNS\u8f6e\u8be2\u914d\u7f6e<\/p>\n

IN MX 10 mail.example.com.\r\n... ...\r\n\r\nmail IN A 192.168.1.9\r\nIN A 192.168.1.10\r\nIN A 192.168.1.11<\/pre>\n

\u5728\u4ee5\u4e0a\u914d\u7f6e\u4e2d\uff0cmail.example.com\u5bf9\u5e94\u4e863\u4e2aIP\u5730\u5740\uff0c\u6b64\u65f6\u5177\u4f53\u9009\u62e9\u54ea\u4e00\u6761A\u8bb0\u5f55\uff0c\u662f\u7531rrset-order\u8bed\u53e5\u51b3\u5b9a\u7684\u3002\u53e6\u5916\uff0c\u5728\u53cd\u5411\u89e3\u6790\u6587\u4ef6\u4e2d\uff0c\u8fd93\u4e2aIP\u4e5f\u90fd\u8981\u5bf9\u5e94mail\u4e3b\u673a\uff0c\u4ee5\u514d\u6709\u4e9b\u90ae\u4ef6\u670d\u52a1\u5668\u4e3a\u4e86\u53cd\u5783\u573e\u90ae\u4ef6\u8fdb\u884c\u53cd\u5411\u67e5\u8be2\u65f6\u51fa\u73b0\u95ee\u9898\u3002<\/p>\n

\u8fd9\u662f\u5728 \/etc\/named.conf \u6587\u4ef6\u4e2d options \u8bed\u53e5\u6709\u5173rrset-order\u914d\u7f6e\u7684\u4e00\u4e2a\u4f8b\u5b50\uff1a<\/p>\n

rrset-order {\r\n\r\nclass IN type A name \"mail.example.com\" order random;\r\n\r\norder cyclic;\r\n\r\n};<\/pre>\n

\u8fd9\u4e2a\u8bbe\u7f6e\u4f1a\u4f7f\u5904\u4e8eIN\u7c7b\u4e2d\u7684A\u8bb0\u5f55\u7684\u54cd\u5e94\u4ee5\u968f\u673a\u987a\u5e8f\u8fd4\u56de\uff0cIN \u7c7b\u4ee5\"mail.example.com\"\u4e3a\u540e\u7f00\u3002\u5176\u4ed6\u7684\u8bb0\u5f55\u4ee5\u5faa\u73af\u8bb0\u5f55\u88ab\u8fd4\u56de\u3002<\/p>\n

rrset-order \u652f\u6301\u4e09\u4e2a\u53c2\u6570\uff1afixed, random, cyclic \u3002
\nfixed \u5c06\u591a\u4e2aA\u8bb0\u5f55\u6309\u914d\u7f6e\u6587\u4ef6\u7684\u987a\u5e8f\u56fa\u5b9a\u7ed9\u51fa
\nrandom \u968f\u673a\u7ed9\u51fa
\ncyclic \u5faa\u73af\u7ed9\u51fa<\/p>\n

\u6ce8\uff1arrset-order\u8bed\u53e5\u5e76\u4e0d\u88abBIND9\u652f\u6301\uff0cBIND9\u76ee\u524d\u53ea\u652f\u6301\"random-cyclic\"\u6392\u5e8f\uff0c\u670d\u52a1\u5668\u968f\u673a\u9009\u62e9RRset\u96c6\u4e2d\u7684\u5f00\u59cb\u70b9\uff0c\u6709\u987a\u5e8f\u8fd4\u56de\u5728\u90a3\u4e2a\u70b9\u5f00\u59cb\u7684\u8bb0\u5f55\u3002<\/p>\n

3\u3001\u6d4b\u8bd5\u770b\u7ed3\u679c\uff1a<\/p>\n

[root@linux252:\/]#host mail.example.com\r\n\r\nmail.example.com has address 192.168.1.9\r\n\r\nmail.example.com has address 192.168.1.10\r\n\r\nmail.example.com has address 192.168.1.11\r\n<\/pre>\n

\u603b\u7ed3\u4e00\u4e0b\uff1a<\/p>\n

DNS\u8f6e\u8be2\u7684\u914d\u7f6e\u662f\u6bd4\u8f83\u65b9\u4fbf\u7684\uff0c\u5982\u679c\u7f51\u7edc\u6269\u589e\uff0c\u65b0\u589e\u7684Web\u670d\u52a1\u5668\u53ea\u8981\u589e\u52a0\u4e00\u4e2a\u516c\u7f51IP\u5373\u53ef\u3002 \u4f46\u76f8\u5bf9\u6765\u8bf4\uff0cDNS\u8f6e\u8be2\u4e5f\u6709\u5176\u81ea\u8eab\u7684\u4e00\u4e9b\u7f3a\u70b9\uff0c\u8fd9\u4e2a\u5de5\u4f5c\u5f53\u4e2d\u4e5f\u662f\u6211\u4eec\u9700\u8981\u6ce8\u610f\u7684\u3002<\/p>\n

\u5176\u4e00\uff1a\u5982\u679c\u67d0\u53f0\u670d\u52a1\u5668\u5b95\u673a\uff0cDNS\u670d\u52a1\u5668\u662f\u65e0\u6cd5\u77e5\u6653\u7684\uff0c\u4ecd\u65e7\u4f1a\u5c06\u8bbf\u95ee\u5206\u914d\u5230\u6b64\u670d\u52a1\u5668\u3002\u4fee\u6539DNS\u8bb0\u5f55\u5168\u90e8\u751f\u6548\u4e00\u822c\u89811-3\u5c0f\u65f6\uff0c\u751a\u81f3\u66f4\u4e45\uff1b<\/p>\n

\u5176\u4e8c\uff1a\u5982\u679c\u51e0\u53f0Web\u670d\u52a1\u5668\u4e4b\u95f4\u7684\u786c\u4ef6\u914d\u7f6e\u4e0d\u540c\uff0c\u5bfc\u81f4\u80fd\u591f\u627f\u53d7\u7684\u538b\u529b\u4e5f\u662f\u4e0d\u540c\u7684\uff0c\u4f46\u662fDNS\u8f6e\u8be2\u89e3\u6790\u76ee\u524d\u4e0d\u80fd\u5f88\u597d\u7684\u6309\u6743\u91cd\u8fdb\u884c\u5206\u914d\u3002<\/p>\n

\u5176\u4e09\uff1a\u5982\u679c\u662f \u9700\u8981\u8eab\u4efd\u9a8c\u8bc1\u7684\u7f51\u7ad9\uff0cDNS\u89e3\u6790\u65e0\u6cd5\u5c06\u9a8c\u8bc1\u7528\u6237\u7684\u8bbf\u95ee\u6301\u4e45\u5206\u914d\u5230\u540c\u4e00\u670d\u52a1\u5668\u3002\u867d\u7136\u6709\u4e00\u5b9a\u7684\u672c\u5730DNS\u7f13\u5b58\uff0c\u4f46\u662f\u5f88\u96be\u4fdd\u8bc1\u5728\u7528\u6237\u8bbf\u95ee\u671f\u95f4\uff0c\u672c\u5730DNS\u4e0d\u8fc7 \u671f\uff0c\u800c\u91cd\u65b0\u67e5\u8be2\u670d\u52a1\u5668\u5e76\u6307\u5411\u4e86\u65b0\u7684\u670d\u52a1\u5668\uff0c\u90a3\u4e48\u539f\u670d\u52a1\u5668\u4fdd\u5b58\u7684\u7528\u6237\u4fe1\u606f\u662f\u65e0\u6cd5\u88ab\u5e26\u5230\u65b0\u670d\u52a1\u5668\u7684\uff0c\u800c\u4e14\u53ef\u80fd\u88ab\u8981\u6c42\u91cd\u65b0\u8ba4\u8bc1\u8eab\u4efd\uff0c\u800c\u4e14\u6765\u56de\u5207\u6362\u65f6\u95f4\u957f\u4e86\u5404\u53f0\u670d \u52a1\u5668\u90fd\u4fdd\u5b58\u6709\u7528\u6237\u4e0d\u540c\u7684\u4fe1\u606f\uff0c\u5bf9\u670d\u52a1\u5668\u8d44\u6e90\u4e5f\u662f\u4e00\u79cd\u6d6a\u8d39\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u4e0d\u8fc7\u6709\u4e00\u4e2a\u53c2\u6570\u4f60\u53ef\u4ee5\u8bd5\u8bd5\u770b\u662f\u5426\u80fd\u8c03\u6574\u4e00\u4e0b\u8f6e\u8be2\u7684\u6548\u679c\uff1a \u5728 named.conf \u4e2d\u53ef\u4ee5\u8bbe\u7f6e bind \u7684 ro […]<\/p>\n","protected":false},"author":1469,"featured_media":196831,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-196827","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/196827","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1469"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=196827"}],"version-history":[{"count":3,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/196827\/revisions"}],"predecessor-version":[{"id":196834,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/196827\/revisions\/196834"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/196831"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=196827"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=196827"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=196827"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}