{"id":2769,"date":"2024-07-19T21:57:22","date_gmt":"2024-07-19T12:57:22","guid":{"rendered":"https:\/\/weblog.hirohiro716.com\/?p=2769"},"modified":"2025-06-30T15:05:58","modified_gmt":"2025-06-30T06:05:58","slug":"ubuntu22-04%e3%81%a7dhcp%e3%81%a8bind%e3%82%92%e9%80%a3%e6%90%ba%e3%81%95%e3%81%9b%e5%ae%b6%e5%ba%ad%e5%86%85ddns","status":"publish","type":"post","link":"https:\/\/weblog.hirohiro716.com\/?p=2769","title":{"rendered":"Ubuntu22.04\u3067dhcp\u3068bind\u3092\u9023\u643a\u3055\u305b\u5bb6\u5ead\u5185DDNS"},"content":{"rendered":"<p>\nDNS(ddns.example.jp)\u30b5\u30fc\u30d0\u30fc\u3082DHCP\u30b5\u30fc\u30d0\u30fc\u30821\u53f0\u3067\u517c\u4efb\u3055\u305b\u308b\u3002ActiveDirectory(ad.example.jp)\u306b\u95a2\u3059\u308b\u30af\u30a8\u30ea\u306f\u30c9\u30e1\u30a4\u30f3\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306b\u30d5\u30a9\u30ef\u30fc\u30c9\u3055\u305b\u308b\u3002\n<\/p>\n<pre class=\"brush: plain; gutter: false; title: ; notranslate\" title=\"\">\r\n\u30fb Ubuntu: 22.04.4\r\n\u30fb bind: 9.13.6\r\n\u30fb isc-dhcp-server: 4.4.1\r\n<\/pre>\n<h4>DNS\u30b5\u30fc\u30d0\u30fc\u306e\u8a2d\u5b9a<\/h4>\n<p>\nbind\u304b\u3089\u8a2d\u5b9a\u3001\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3002\n<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# apt install bind9\r\n<\/pre>\n<p>\n\u30aa\u30d7\u30b7\u30e7\u30f3\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u5909\u66f4\u307e\u305f\u306f\u8ffd\u8a18\u3059\u308b\u3002\n<\/p>\n<pre class=\"brush: plain; title: \/etc\/bind\/named.conf.options; notranslate\" title=\"\/etc\/bind\/named.conf.options\">\r\noptions {\r\n    directory &quot;\/var\/cache\/bind&quot;;\r\n    \u2026\r\n    \/\/ \u81ea\u5206\u3067\u540d\u524d\u89e3\u6c7a\u3067\u304d\u306a\u3044\u3068\u304d\u306e\u4e38\u6295\u3052\u5148\r\n    forwarders {\r\n        192.168.1.254;\r\n        8.8.8.8;\r\n    };\r\n    \u2026\r\n    \/\/ DNSSEC\u306f\u691c\u8a3c\u3057\u3066\u304f\u308c\u308bDNS\u30b5\u30fc\u30d0\u30fc\u306b\u30d5\u30a9\u30ef\u30fc\u30c9\u3059\u308b\u306a\u3089\u7121\u52b9\u306b\u3057\u3066\u3082\u3044\u3044\r\n    dnssec-validation auto;\r\n    validate-except {\r\n        &quot;ad.example.jp&quot;;\r\n    };\r\n    \u2026\r\n    \/\/ IPv6\u3092\u7121\u52b9\u5316\r\n    listen-on-v6 { none; };\r\n    \u2026\r\n    \/\/ LAN\u5185\u304b\u3089\u306e\u554f\u3044\u5408\u308f\u305b\u3092\u8a31\u53ef\r\n    allow-query {\r\n        localhost;\r\n        192.168.1.0\/24;\r\n    };\r\n};\r\n<\/pre>\n<p>\n\u30ed\u30fc\u30ab\u30eb\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306b\u8ffd\u8a18\u3059\u308b\u3002\n<\/p>\n<pre class=\"brush: plain; title: \/etc\/bind\/named.conf.local; notranslate\" title=\"\/etc\/bind\/named.conf.local\">\r\nzone &quot;ddns.example.jp.&quot; {\r\n    type master;\r\n    file &quot;ddns.example.jp.zone&quot;;\r\n    \/\/ \u81ea\u8eab\u304b\u3089\u306e\u5909\u66f4\u3092\u8a31\u53ef\r\n    allow-update {\r\n        localhost;\r\n    };\r\n};\r\nzone &quot;ad.example.jp.&quot; {\r\n    type forward;\r\n    forward only;\r\n    forwarders {\r\n        192.168.1.12;\r\n    };\r\n};\r\n<\/pre>\n<p>\n\u3055\u3063\u304d\u6307\u5b9a\u3057\u305fzone\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\u3002<br \/>\n\u203b&#8221;admin.ddns.example.jp.&#8221;\u306f&#8221;admin@ddns.example.jp&#8221;\u3068\u3044\u3046\u7ba1\u7406\u8005\u306eE-mail\u3068\u3044\u3046\u610f\u5473\u3089\u3057\u3044\n<\/p>\n<pre class=\"brush: plain; title: \/var\/cache\/bind\/ddns.example.jp.zone; notranslate\" title=\"\/var\/cache\/bind\/ddns.example.jp.zone\">\r\n$TTL 86400\r\n@    IN    SOA    sv.ddns.example.jp.    admin.ddns.example.jp. (\r\n           2024071501\r\n           10800\r\n           36400\r\n           604800\r\n           86400\r\n)\r\n\r\n        IN    NS   sv.ddns.example.jp.\r\nsv      IN    A    192.168.1.11\r\n<\/pre>\n<p>\n\u4f5c\u6210\u3057\u305f\u3089\u30d5\u30a1\u30a4\u30eb\u306e\u6240\u6709\u8005\u3092bind\u306b\u5909\u66f4\u3059\u308b\u3002\n<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# chown bind:bind \/var\/cache\/bind\/ddns.example.jp.zone\r\n<\/pre>\n<p>\n\u30b5\u30fc\u30d3\u30b9\u3092\u6709\u52b9\u306b\u3057\u3066\u8d77\u52d5\u3002\n<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# systemctl enable --now named\r\n<\/pre>\n<h4>DHCP\u30b5\u30fc\u30d0\u30fc\u306e\u8a2d\u5b9a<\/h4>\n<p>\n\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3002\n<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# apt install isc-dhcp-server\r\n<\/pre>\n<p>\n\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3067\u4e0b\u8a18\u306e\u7b87\u6240\u3092\u5909\u66f4\u3059\u308b\u3002\n<\/p>\n<pre class=\"brush: plain; title: \/etc\/dhcp\/dhcpd.conf; notranslate\" title=\"\/etc\/dhcp\/dhcpd.conf\">\r\n\u2026\r\n# DNS\u30b5\u30fc\u30d0\u30fc\u306b\u66f4\u65b0\u8981\u6c42\u3092\u9001\u4fe1\u3059\u308b\u8a2d\u5b9a\r\nddns-update-style interim;\r\n\u2026\r\n# \u666e\u901a\u306eDHCP\u306e\u8a2d\u5b9a\r\nsubnet 192.168.1.0 netmask 255.255.255.0 {\r\n    range 192.168.1.101 192.168.1.120;\r\n    option routers 192.168.1.254;\r\n    option domain-name &quot;ddns.example.jp&quot;;\r\n    option domain-name-servers 192.168.1.11;\r\n    # \u66f4\u65b0\u3092\u901a\u77e5\u3059\u308bDNS\u30b5\u30fc\u30d0\u30fc\u3092\u6307\u5b9a\r\n    zone ddns.example.jp. {\r\n        primary localhost;\r\n    }\r\n}\r\n<\/pre>\n<p>\n\u30b5\u30fc\u30d3\u30b9\u3092\u6709\u52b9\u306b\u3057\u3066\u8d77\u52d5\u3002\n<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# systemctl enable --now isc-dhcp-server\r\n<\/pre>\n<h4>\u88dc\u8db3<\/h4>\n<h5>\u73fe\u5728\u306eDNS\u30ec\u30b3\u30fc\u30c9\u306e\u78ba\u8a8d<\/h5>\n<p>\nrndc\u3067dump\u3057\u3066\u73fe\u5728\u306eDNS\u30ec\u30b3\u30fc\u30c9\u3092\u78ba\u8a8d\u3059\u308b\u3002\n<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# rndc dumpdb -zones\r\n# less \/var\/cache\/bind\/named_dump.db\r\n<\/pre>\n<h5>DNS\u30ec\u30b3\u30fc\u30c9\u306e\u66f4\u65b0\u30c6\u30b9\u30c8<\/h5>\n<p>\nnsupdate\u3092\u4f7f\u7528\u3057\u3066DNS\u30b5\u30fc\u30d0\u30fc\u3092\u66f4\u65b0\u3092\u30c6\u30b9\u30c8\u3059\u308b\u306b\u306fbind-utils\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3001nsupdate\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3002\u5b9f\u884c\u3057\u305f\u3089\u5bfe\u8a71\u578b\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u306a\u308b\u306e\u3067\u4e0b\u8a18\u306e\u3088\u3046\u306a\u611f\u3058\u3067\u5165\u529b\u3059\u308b\u3002\u4f55\u3082\u30a8\u30e9\u30fc\u304c\u51fa\u306a\u3051\u308c\u3070OK\u3002<br \/>\n\u203bIN\u306f\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u306e\u610f\u5473\u3089\u3057\u3044\u304c\u672a\u6307\u5b9a\u3067\u3082\u554f\u984c\u306a\u3044<\/p>\n<p><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&gt;server 127.0.0.1\r\n&gt;update add test.ddns.example.jp. 3600 IN A 192.168.1.222\r\n&gt;send\r\n&gt;server 127.0.0.1\r\n&gt;update delete test.ddns.example.jp. IN\r\n&gt;send\r\n<\/pre>\n<h5>DNS\u30ec\u30b3\u30fc\u30c9\u306e\u524a\u9664<\/h5>\n<p>\n\u307e\u308c\u306bDNS\u30ec\u30b3\u30fc\u30c9\u306eIP\u30a2\u30c9\u30ec\u30b9\u304c\u4e00\u5207\u66f4\u65b0\u3055\u308c\u306a\u304f\u306a\u308b\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304c\u3042\u308b\u3002nsupdate\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u53e4\u3044DNS\u30ec\u30b3\u30fc\u30c9\u3092\u524a\u9664\u3059\u308b\u3068\u305d\u306e\u3046\u3061\u76f4\u308b\u3002<\/p>\n<p><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&gt;server 127.0.0.1\r\n&gt;update delete test.example.jp.\r\n&gt;send\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>DNS(ddns.example.jp)\u30b5\u30fc\u30d0\u30fc\u3082DHCP\u30b5\u30fc\u30d0\u30fc\u30821\u53f0\u3067\u517c\u4efb\u3055\u305b\u308b\u3002ActiveDirectory(ad.example.jp)\u306b\u95a2\u3059\u308b\u30af\u30a8\u30ea\u306f\u30c9\u30e1\u30a4\u30f3\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u306b\u30d5\u30a9\u30ef\u30fc\u30c9\u3055\u305b\u308b\u3002 \u30fb Ubunt [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-2769","post","type-post","status-publish","format-standard","hentry","category-ubuntu"],"views":1596,"_links":{"self":[{"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=\/wp\/v2\/posts\/2769","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2769"}],"version-history":[{"count":21,"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=\/wp\/v2\/posts\/2769\/revisions"}],"predecessor-version":[{"id":3114,"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=\/wp\/v2\/posts\/2769\/revisions\/3114"}],"wp:attachment":[{"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2769"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2769"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/weblog.hirohiro716.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2769"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}