{"id":8298,"date":"2021-01-06T21:31:31","date_gmt":"2021-01-06T12:31:31","guid":{"rendered":"http:\/\/www.k-in.co.jp\/niwakan\/?p=8298"},"modified":"2021-11-17T16:55:43","modified_gmt":"2021-11-17T07:55:43","slug":"kea-dhcp%e3%82%92%e5%85%a5%e3%82%8c%e3%81%a6%e3%81%bf%e3%81%9f%ef%bc%88%e3%81%9d%e3%81%ae2%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.k-in.co.jp\/niwakan\/archives\/2021\/01\/8298\/","title":{"rendered":"Kea DHCP\u3092\u5165\u308c\u3066\u307f\u305f\uff08\u305d\u306e2\uff09"},"content":{"rendered":"<p><a href=\"https:\/\/www.k-in.co.jp\/niwakan\/archives\/2020\/12\/8284\/\">\u524d\u56de<\/a>\u306e\u7d9a\u304d\u3002<\/p>\n<p>OSX Server.app\u306eDHCPD\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u8868\u793a\u65b9\u6cd5\u3092\u77e5\u3063\u305f\u3002<br \/>\n<code>\/Applications\/Server.app\/Contents\/ServerRoot\/usr\/sbin\/serveradmin settings dhcp<\/code><\/p>\n<p>\u3053\u308c\u3092SQL\u306b\u7f6e\u304d\u63db\u3048\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u66f8\u3051\u3070\u4e00\u62ec\u3067\u767b\u9332\u3067\u304d\u305d\u3046\u3002<br \/>\n\u4e0b\u8a18\u306fphpMyAdmin\u3067\u767b\u9332\u3057\u305f\u3082\u306e\u304b\u3089\u3001NULL\u306e\u90e8\u5206\u3092\u524a\u3063\u305f\u3082\u306e\u3002<\/p>\n<pre>INSERT INTO `hosts` (\r\n  `host_id`, \r\n  `dhcp_identifier_type`, \r\n  `dhcp_identifier`,\r\n  `dhcp_identifier_str`,\r\n  `ipv4_address`,\r\n  `ipv4_address_str`,\r\n  `hostname`\r\n) VALUES (\r\n  NULL,\r\n  '0',\r\n  UNHEX('08002710df72'),\r\n  '08:00:27:10:df:72',\r\n  INET_ATON('192.168.0.83'),\r\n  '192.168.0.83',\r\n  'VM-WinXP'\r\n);<\/pre>\n<p><strong>dhcp_identifier_str<\/strong>\u3068<strong>ipv4_address_str<\/strong>\u306f\u76f4\u63a5\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u8ffd\u52a0\u3057\u305f\u30ab\u30e9\u30e0\u3067\u3042\u308b\u3002<br \/>\nphpMyAdmin\u4e0a\u3067\u691c\u7d22\u304c\u3057\u6613\u304b\u308d\u3046\u3068\u601d\u3063\u305f\u306e\u3060\u3002<br \/>\n\u5f53\u7136\u3001kea dhcp\u306f\u3053\u3053\u3092\u53c2\u7167\u3057\u306a\u3044\u3002kea\u304b\u3089\u767b\u9332\uff08\u3067\u304d\u308b\u304b\u306f\u77e5\u3089\u306a\u3044\u304c\uff09\u3059\u308b\u3068\u7a7a\u767d\u3068\u306a\u308b\u3002\u3086\u3048\u306b\u7a7a\u767d\u53ef\u3068\u306a\u3063\u3066\u3044\u308b\u3002<\/p>\n<pre>dhcp_identifier_str\uff1avarchar(17)\u3000utf8_general_ci NULL=\u306f\u3044\r\nipv4_address_str\uff1avarchar(15)\u3000utf8_general_ci NULL=\u306f\u3044<\/pre>\n<p>\u3053\u3093\u306a\u611f\u3058\u3002<\/p>\n<p>\u53c2\u7167\u3057\u305f\u306e\u306f\u3053\u3061\u3089\u3002<br \/>\n<a href=\"https:\/\/krypted.com\">krypted<\/a>\u3055\u3093\u3068\u3053\u306e\u300c<a href=\"https:\/\/krypted.com\/mac-os-x\/replace-macos-server-dhcp-service-built-macos-dhcp-service\/\">Replace the macOS Server DHCP Service with bootp<\/a>\u300d<br \/>\n\u3057\u304b\u3057\u3001\u672a\u3060\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u8aad\u3093\u3067\u3044\u308b\u306e\u304b\u5224\u3089\u306a\u3044\u2026\u2026<\/p>\n<p>kea\u306e\u30b5\u30a4\u30c8\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u63a2\u3057\u3066\u307f\u305f\u3002<br \/>\n<strong>kea-dhcp4.conf<\/strong>\u306e\u4e2d\u3092\u78ba\u8a8d\u3059\u308b\u3002<\/p>\n<p><strong>&#8220;Dhcp4&#8221;: {<\/strong><br \/>\n\u3068\u3044\u3046\u5b9a\u7fa9\u306e\u4e0b\u306b\u3042\u308b<\/p>\n<pre>\"hosts-database\": {\r\n        \"type\": \"mysql\",\r\n        \"name\": \"database name\",\r\n        \"user\": \"user name\",\r\n        \"password\": \"password\",\r\n        \"host\": \"localhost\",\r\n        \"port\": 3306\r\n    },<\/pre>\n<p>\u3053\u3053\u3067\u5b9a\u7fa9\u3055\u308c\u3066\u308c\u3070\u8aad\u3093\u3067\u3044\u308b\u3093\u3060\u3068\u78ba\u5b9a\u3002<\/p>\n<p>\u7406\u7531\u306f\u3001<strong>kea-dhcp4.log<\/strong>\u3067\u3001hosts table\u306b\u767b\u9332\u3055\u308c\u3066\u3044\u306a\u3044Hardware adderess\u3092\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u767b\u9332\u3057\u305f\u3089\u3001ip address\u306e\u5272\u308a\u632f\u308a\u304c\u5909\u308f\u3063\u305f\u304b\u3089\u3002<br \/>\n\u3053\u308c\u3067dns\u3082\u3084\u3063\u3066\u304f\u308c\u308c\u3070\u5b8c\u74a7\u3060\uff01<br \/>\nguest client\u306b\u9069\u5f53\u306a\u540d\u524d\u3082\u3064\u3051\u3066\u304f\u308c\u308c\u3070\u3001\u5c1a\u5b09\u3057\u3044\u3002<\/p>\n<p>\u52e2\u3044\u306b\u4e57\u3063\u3066server.app\u306edump\u304b\u3089sql\u4f5c\u6210\u7528\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u7d44\u3093\u3058\u3083\u3063\u305f\uff08\u7b11\uff09<\/p>\n<pre>\r\n\/*\r\n osx server\u4e0a\u306edhcp database\u306edump\u304b\u3089kea dhcp database\u306esql\u3092\u4f5c\u6210\u3059\u308b\r\n \u7d14\u6b63\u306etable\u3092\u62e1\u5f35\uff08dhcp_identifier_str\u3068ipv4_address_str\uff09\u3057\u3066\u307e\u3059\u3002\r\n \u30b3\u30e1\u30f3\u30c8\u5316\u3055\u308c\u3066\u3044\u308b\u3082\u306e\u3068\u5207\u308a\u66ff\u3048\u3066\u304a\u4f7f\u3044\u304f\u3060\u3055\u3044\u3002\r\n*\/\r\n\r\n$sql_format = \"INSERT INTO `hosts` (`host_id`, `dhcp_identifier_type`, `dhcp_identifier`, `dhcp_identifier_str`, `ipv4_address`, `ipv4_address_str`, `hostname`) VALUES (NULL, '0', UNHEX('%s'), '%s', INET_ATON('%s'), '%s', '%s');\\n\";\r\n\/\/$sql_format = \"INSERT INTO `hosts` (`host_id`, `dhcp_identifier_type`, `dhcp_identifier`, `ipv4_address`, `hostname`) VALUES (NULL, '0', UNHEX('%s'), INET_ATON('%s'), '%s');\\n\";\t\t\/\/ \u7d14\u6b63\u7528\r\n\r\n$infile = \"DHCPsetting.txt\";\r\n$outfile = \"DHCPsetting.sql\";\r\n\r\n$file = file ( $infile );\r\n$sqls = array();\r\n$matches = array();\r\n$line = \"\";\r\n\r\nforeach ( $file as $line ) {\r\n\tif ( preg_match ( '#ip_address:_array_index:0 = \"([0-9\\.]+)\"#', $line, $matches ) ) {\r\n\t\t$ip = $matches[1];\r\n\t} elseif ( preg_match ( '#en_address:_array_index:0 = \"([0-9A-Za-z:]+)\"#', $line, $matches ) ) {\r\n\t\t$hw = $matches[1];\r\n\t} elseif ( preg_match ( '#static_maps.+name = \"([^\"]+)\"#', $line, $matches ) ) {\r\n\t\t$name = $matches[1];\r\n\t\t$sqls[] = sprintf ( $sql_format, preg_replace ( \"#:#\", \"\", $hw ), $hw, $ip, $ip, $name );\r\n\/\/\t\t$sqls[] = sprintf ( $sql_format, preg_replace ( \"#:#\", \"\", $hw ), $ip, $name );\t\t\/\/ \u7d14\u6b63\u7528\r\n\t}\r\n}\r\n\r\n$out = fopen ( $outfile, \"w\" );\r\nforeach ( $sqls as $line ) {\r\n\tfwrite ( $out, $line );\r\n}<\/pre>\n<p>perl\u3058\u3083\u306a\u304f\u3066php\u306a\u306e\u306f\u8da3\u5473\u3002<br \/>\n\u767b\u9332\u3082\u6e08\u3093\u3060\u306e\u3067\u3001\u3053\u308c\u304b\u3089\u306flocal net\u5185\u306e\u56fa\u5b9a\u30a2\u30c9\u30ec\u30b9\u5316\u304c\u5fa9\u6d3b\u3060\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u306e\u7d9a\u304d\u3002 OSX Server.app\u306eDHCPD\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u8868\u793a\u65b9\u6cd5\u3092\u77e5\u3063\u305f\u3002 \/Applications\/Server.app\/Contents\/ServerRoot\/usr\/sbin\/serveradmin  &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.k-in.co.jp\/niwakan\/archives\/2021\/01\/8298\/\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Kea DHCP\u3092\u5165\u308c\u3066\u307f\u305f\uff08\u305d\u306e2\uff09&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[115],"tags":[169,148,46,24],"class_list":["post-8298","post","type-post","status-publish","format-standard","hentry","category-software","tag-keadhcp","tag-server","tag-software","tag-system"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.k-in.co.jp\/niwakan\/wp-json\/wp\/v2\/posts\/8298","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.k-in.co.jp\/niwakan\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.k-in.co.jp\/niwakan\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.k-in.co.jp\/niwakan\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.k-in.co.jp\/niwakan\/wp-json\/wp\/v2\/comments?post=8298"}],"version-history":[{"count":0,"href":"https:\/\/www.k-in.co.jp\/niwakan\/wp-json\/wp\/v2\/posts\/8298\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.k-in.co.jp\/niwakan\/wp-json\/wp\/v2\/media?parent=8298"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.k-in.co.jp\/niwakan\/wp-json\/wp\/v2\/categories?post=8298"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.k-in.co.jp\/niwakan\/wp-json\/wp\/v2\/tags?post=8298"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}