{"id":10872,"date":"2023-01-11T15:56:19","date_gmt":"2023-01-11T06:56:19","guid":{"rendered":"https:\/\/www.stuffy.site\/computers\/?p=10872"},"modified":"2023-03-16T14:40:15","modified_gmt":"2023-03-16T05:40:15","slug":"%e3%81%b7%e3%81%a1%e3%82%b9%e3%82%bf%e3%83%87%e3%82%a3aws-dhcp%e3%82%aa%e3%83%97%e3%82%b7%e3%83%a7%e3%83%b3%e3%82%bb%e3%83%83%e3%83%88%e3%81%ae%e8%a8%ad%e5%ae%9a","status":"publish","type":"post","link":"https:\/\/www.stuffy.site\/computers\/archives\/10872","title":{"rendered":"\u3077\u3061\u30b9\u30bf\u30c7\u30a3@AWS DHCP\u30aa\u30d7\u30b7\u30e7\u30f3\u30bb\u30c3\u30c8\u306e\u8a2d\u5b9a"},"content":{"rendered":"\n<p>\u524d\u56de\u3001EC2\u306eDNS\u3092\u7dca\u6025\u907f\u96e3\u7684\u306b\u8a2d\u5b9a\u3057\u307e\u3057\u305f\u304cdocker\u30d6\u30ea\u30c3\u30b8\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u4e0a\u3067\u306e\u30b3\u30f3\u30c6\u30ca\u5c55\u958b\u304c\u539f\u56e0\u3067\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u30b9\u30c6\u30fc\u30bf\u30b9\u30c1\u30a7\u30c3\u30af\u3067\u63a5\u7d9a\u6027\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u3044\u305f\u3053\u3068\u3092\u6094\u3044\u6539\u3081\u308b\u3068\u3068\u3082\u306bdnsmasq\u30b3\u30f3\u30c6\u30ca\u3067\u7c21\u6613DNS\u3092\u30a2\u30c3\u30d7\u3001DHCP\u30aa\u30d7\u30b7\u30e7\u30f3\u30bb\u30c3\u30c8\u306e\u8a2d\u5b9a\u3092\u3057\u305f\u985b\u672b\u3092\u3053\u3053\u306b\u8a18\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>\u524d\u56de\u3001<a href=\"https:\/\/www.stuffy.site\/computers\/2023\/01\/07\/%e3%81%b7%e3%81%a1%e3%82%b9%e3%82%bf%e3%83%87%e3%82%a3docker-compose-ip%e3%82%a2%e3%83%89%e3%83%ac%e3%82%b9%e3%81%ae%e5%9b%ba%e5%ae%9a\/\">\u3077\u3061\u30b9\u30bf\u30c7\u30a3@docker-compose IP\u30a2\u30c9\u30ec\u30b9\u56fa\u5b9a<\/a> \u3067EC2\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u30b9\u30c6\u30fc\u30bf\u30b9\u30c1\u30a7\u30c3\u30af\u3067\u300c\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u63a5\u7d9a\u6027\u30c1\u30a7\u30c3\u30af\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002\u300d\u3068\u51fa\u305f\u306e\u3067docker\u30d6\u30ea\u30c3\u30b8\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9IPv4\u306b\u5408\u308f\u305b\u3066\u30b3\u30f3\u30c6\u30ca\u3092\u8d77\u52d5\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u539f\u56e0\u306f\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u30d7\u30e9\u30a4\u30d9\u30fc\u30c8IP\u3068\u30b3\u30f3\u30c6\u30ca\u306e\u30d6\u30ea\u30c3\u30b8IP\u306e\u30bb\u30b0\u30e1\u30f3\u30c8\u306e\u76f8\u9055\u3067\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u4eca\u56de\u306f\u3001\u304a\u4f7f\u3044\u306eVPC\u306eDHCP\u30aa\u30d7\u30b7\u30e7\u30f3\u30bb\u30c3\u30c8\u3092\u8a2d\u5b9a\u3001dnsmasq\u3092\u7c21\u6613\u30cd\u30fc\u30e0\u30b5\u30fc\u30d0\u30fc\u3068\u3057\u3066\u30b3\u30f3\u30c6\u30ca\u8d77\u52d5\u3057\u305f\u306e\u3067\u7d4c\u7def\u3092\u3081\u3082\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>[\u30a8\u30e9\u30fc\u306e\u51fa\u3066\u3044\u305f\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u69cb\u6210]<\/p>\n\n\n<table>\n<tbody>\n<tr>\n<td>\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9IPv4\u30a2\u30c9\u30ec\u30b9<\/td>\n<td>172.31.15.141<\/td>\n<\/tr>\n<tr>\n<td>docker \u30d6\u30ea\u30c3\u30b8IP\u30a2\u30c9\u30ec\u30b9<\/td>\n<td>172.31.0.0\/24<\/td>\n<\/tr>\n<tr>\n<td>\u30b3\u30f3\u30c6\u30ca\u30b2\u30fc\u30c8\u30a6\u30a7\u30a4<\/td>\n<td>172.31.0.1<\/td>\n<\/tr>\n<tr>\n<td>dnsmasq \u30cd\u30fc\u30e0\u30b5\u30fc\u30d0\u30fc<\/td>\n<td>172.31.0.2<\/td>\n<\/tr>\n<tr>\n<td>wordpress\u306eIP\u30a2\u30c9\u30ec\u30b9<\/td>\n<td>172.31.0.3<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\n\n<p>[\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9IP(eth0)\u306b\u5f93\u3063\u3066\u30b3\u30f3\u30c6\u30caIP\u56fa\u5b9a\u3057\u305f\u69cb\u6210]<\/p>\n\n\n<table>\n<tbody>\n<tr>\n<td>\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9IPv4\u30a2\u30c9\u30ec\u30b9<\/td>\n<td>172.31.15.141<\/td>\n<\/tr>\n<tr>\n<td>\u30b3\u30f3\u30c6\u30ca\u30b5\u30d6\u30cd\u30c3\u30c8<\/td>\n<td>172.31.15.0\/24<\/td>\n<\/tr>\n<tr>\n<td>\u30b3\u30f3\u30c6\u30ca\u30b2\u30fc\u30c8\u30a6\u30a7\u30a4<\/td>\n<td>172.31.15.1<\/td>\n<\/tr>\n<tr>\n<td>dnsmasq \u30cd\u30fc\u30e0\u30b5\u30fc\u30d0\u30fc<\/td>\n<td>172.31.15.2<\/td>\n<\/tr>\n<tr>\n<td>mysql\u306eIP\u30a2\u30c9\u30ec\u30b9<\/td>\n<td>172.31.15.3<\/td>\n<\/tr>\n<tr>\n<td>wordpress\u306eIP\u30a2\u30c9\u30ec\u30b9<\/td>\n<td>172.31.15.4<\/td>\n<\/tr>\n<tr>\n<td>https-portal\u306eIP\u30a2\u30c9\u30ec\u30b9<\/td>\n<td>172.31.15.10<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\n\n<h2 class=\"wp-block-heading\">VPC\u306eDHCP\u30aa\u30d7\u30b7\u30e7\u30f3\u30bb\u30c3\u30c8\u3067\u30cd\u30fc\u30e0\u30b5\u30fc\u30d0\u30fc\u3092\u8a2d\u5b9a\u3059\u308b<\/h2>\n\n\n\n<p><a href=\"https:\/\/dev.classmethod.jp\/articles\/impact-of-changing-the-domain-name-in-the-dhcp-options-sets\/\">DHCP \u30aa\u30d7\u30b7\u30e7\u30f3\u30bb\u30c3\u30c8\u306e\u30c9\u30e1\u30a4\u30f3\u540d\u3092\u5909\u66f4\u3059\u308b\u3068 EC2 \u306e\u30db\u30b9\u30c8\u540d\u3082\u5909\u66f4\u3055\u308c\u308b\u306e\u304b\u78ba\u8a8d\u3057\u3066\u307f\u305f | DevelopersIO<\/a><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\uff11\uff0eDHCP\u30aa\u30d7\u30b7\u30e7\u30f3\u30bb\u30c3\u30c8\u3092\u4f5c\u308b<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><a href=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/01\/dhcp-option-set.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/01\/dhcp-option-set.png\" alt=\"\" class=\"wp-image-10875\" width=\"487\" height=\"500\" srcset=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/01\/dhcp-option-set.png 974w, https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/01\/dhcp-option-set-292x300.png 292w, https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/01\/dhcp-option-set-768x788.png 768w\" sizes=\"auto, (max-width: 487px) 100vw, 487px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p>\uff12\uff0eVPC\u306b\u9069\u7528\u3059\u308b<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><a href=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/01\/edit-vpc-config.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/01\/edit-vpc-config.png\" alt=\"\" class=\"wp-image-10876\" width=\"488\" height=\"509\" srcset=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/01\/edit-vpc-config.png 976w, https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/01\/edit-vpc-config-288x300.png 288w, https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/01\/edit-vpc-config-768x801.png 768w\" sizes=\"auto, (max-width: 488px) 100vw, 488px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p>\u7d9a\u3044\u3066 <a href=\"https:\/\/qiita.com\/robozushi10\/items\/bc455bff0899d2d73f58\">[02] docker-compose \u3092\u4f7f\u3063\u3066\u5373\u5ea7\u306b dnsmasq \u3092\u7acb\u3066\u308b (\u89e3\u8aac)<\/a> \u3092\u53c2\u8003\u306b\u65e2\u5b58\u306edocker-compose.yml \u306b\u30b5\u30fc\u30d3\u30b9\u3092\u8ffd\u52a0\u3057\u3066\u540c\u4e00\u30b5\u30d6\u30cd\u30c3\u30c8\u4e0a\u306b dnsmasq \u3092\u5efa\u3066\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n<pre><span style=\"font-size: 14pt; color: #0000ff;\">vi docker-compose.yml<\/span>\n  <span style=\"font-size: 12pt;\">\n\u30fb\n\u30fb\n  dnsmasq:\n    restart: always\n    image: 4km3\/dnsmasq\n    container_name: mydnsmasq\n    environment:\n      TZ: \"Asia\/Tokyo\"\n    ports:\n      - \"53:53\/udp\"\n      - \"53:53\/tcp\"\n    # PC \u3092 DNS \u306b\u767b\u9332\u3057\u305f\u3044\u5834\u5408\u306f .\/PV\/etc\/dnsmasq.d\/add_hosts \u3092\u7de8\u96c6\u3059\u308b\n    volumes:\n      - '.\/PV\/etc\/dnsmasq.d:\/etc\/dnsmasq.d'\n    networks:\n      wp000net1:\n        ipv4_address: 172.31.15.2\n    dns:\n      # \u672c\u30d5\u30a1\u30a4\u30eb\u306e\u300cdns\u300d\u306b\u5bfe\u3057\u3066\u3001\u4e0a\u4f4d\u306e DNS\u30b5\u30fc\u30d0\u3092\u5b9a\u7fa9\u3057\u3066\u3057\u307e\u3048\u3070\u3001\n      # PV\/etc\/dnsmasq.d\/my.conf \u306b\u4e0a\u4f4d DNS\u30b5\u30fc\u30d0\u3092\u5b9a\u7fa9\u3059\u308b\u624b\u9593\u304c\u7701\u3051\u308b.\n      - 8.8.8.8\n      - 127.0.0.1\n    cap_add:\n      - NET_ADMIN<\/span><\/pre>\n\n\n<p>docker-compose up -d \u3057\u3066dnsmasq \u306e\u30b3\u30f3\u30c6\u30caIP\u3092\u78ba\u8a8d\u3002<\/p>\n\n\n<pre><span style=\"font-size: 14pt; color: #0000ff;\">docker-compose exec -it mydnsmasq \/bin\/sh -c \"cat \/etc\/hosts\"<\/span>\n127.0.0.1       localhost\n::1     localhost ip6-localhost ip6-loopback\nfe00::0 ip6-localnet\nff00::0 ip6-mcastprefix\nff02::1 ip6-allnodes\nff02::2 ip6-allrouters\n172.31.15.2     ffc7fa388d26<\/pre>\n\n\n<p>dig\u3067wordpress\u30b3\u30f3\u30c6\u30caIP\u3092\u78ba\u8a8d\u3002<\/p>\n\n\n<pre><span style=\"font-size: 14pt;\">[ec2-user@sanaru wordpress]$ <\/span><span style=\"font-size: 14pt; color: #0000ff;\">dig sanaru.info<br><br><\/span><span style=\"font-size: 12pt;\">; &lt;&lt;&gt;&gt; DiG 9.11.4-P2-RedHat-9.11.4-26.P2.amzn2.5.2 &lt;&lt;&gt;&gt; sanaru.info\n;; global options: +cmd\n;; Got answer:\n;; -&gt;&gt;HEADER&lt;&lt;- opcode: QUERY, status: NOERROR, id: 24032\n;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0\n\n;; QUESTION SECTION:\n;sanaru.info.                   IN      A\n\n;; ANSWER SECTION:\nsanaru.info.            600     IN      A       172.31.15.4\n\n;; Query time: 0 msec\n;; SERVER: 172.31.15.2#53(172.31.15.2)\n;; WHEN: Wed Jan 11 15:43:50 JST 2023\n;; MSG SIZE  rcvd: 56<\/span>\n<\/pre>\n\n\n<p>\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u518d\u8d77\u52d5\u3059\u308b\u3068\u63a5\u7d9a\u6027\u30c1\u30a7\u30c3\u30af\u306b\u5408\u683c\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/01\/check_pass.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"201\" src=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/01\/check_pass-1024x201.png\" alt=\"\" class=\"wp-image-10878\" srcset=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/01\/check_pass-1024x201.png 1024w, https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/01\/check_pass-300x59.png 300w, https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/01\/check_pass-768x150.png 768w, https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/01\/check_pass.png 1098w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u3001EC2\u306eDNS\u3092\u7dca\u6025\u907f\u96e3\u7684\u306b\u8a2d\u5b9a\u3057\u307e\u3057\u305f\u304cdocker\u30d6\u30ea\u30c3\u30b8\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u4e0a\u3067\u306e\u30b3\u30f3\u30c6\u30ca\u5c55\u958b\u304c\u539f\u56e0\u3067\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u30b9\u30c6\u30fc\u30bf\u30b9\u30c1\u30a7\u30c3\u30af\u3067\u63a5\u7d9a\u6027\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u3044\u305f\u3053\u3068\u3092\u6094\u3044\u6539\u3081\u308b\u3068\u3068\u3082\u306bdnsmasq\u30b3\u30f3\u30c6\u30ca\u3067\u7c21\u6613D [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32,88,33,102,46],"tags":[],"class_list":["post-10872","post","type-post","status-publish","format-standard","hentry","category-aws-2","category-dhcp","category-dns","category-dnsmasq","category-docker"],"_links":{"self":[{"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/posts\/10872","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/comments?post=10872"}],"version-history":[{"count":11,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/posts\/10872\/revisions"}],"predecessor-version":[{"id":10889,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/posts\/10872\/revisions\/10889"}],"wp:attachment":[{"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/media?parent=10872"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/categories?post=10872"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/tags?post=10872"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}