前回に続いて、先へ進めません。どうしよう。
“mail serverの移行(その5)古い方をなんとかしたい(できない)” の続きを読む
Kea DHCPを入れてみた(その3)
以前、Kea DHCPを入れてみた(その2)から先、何もしていなかったら、当然の如く、Kea DHCPは動いていなかった。
“Kea DHCPを入れてみた(その3)” の続きを読む
mail serverの移行(その2)DOVECOTを動かすぞ
mail serverの移行(その1)でpostfixの設定をしていたが、よく判らん。
なので、放って次に行く。
DOVECOTである。
“mail serverの移行(その2)DOVECOTを動かすぞ” の続きを読む
mail serverの移行(その1)Postfixを動かすぞ
web serverが動くようになったので、続けてmail serverもお引越ししようと思う。
最初はとにかくPostfixである。理由は無い。
“mail serverの移行(その1)Postfixを動かすぞ” の続きを読む
web serverの移行(その10)Uploaderのエラー
もう全部終わった……と思った時期もありました。
そんなこたぁなかったぜぃ(涙)
“web serverの移行(その10)Uploaderのエラー” の続きを読む
web serverの移行(その9)Microsoftのクローラーを排除したい
errorやwarningが無いかと、apacheのログを見ていて気が付いた。
MicrosoftのBotが入ってきている。
“web serverの移行(その9)Microsoftのクローラーを排除したい” の続きを読む
web serverの移行(その8)SSL認証のエラーっぽいメッセージを消したい
さて、今月20日でmail及びwebサーバーの認証が切れてしまうということで、新しく取得することにした。
値段で決めたFUJI SSLで取得した。
“web serverの移行(その8)SSL認証のエラーっぽいメッセージを消したい” の続きを読む
web serverの移行(その7)ログのローテートがしたい
Apache2のLogをチェックしていて思った。
「ログが多い〜、確認し辛い〜」
“web serverの移行(その7)ログのローテートがしたい” の続きを読む
Kea DHCPを入れてみた(その2)
前回の続き。
OSX Server.appのDHCPDデータベースの表示方法を知った。
/Applications/Server.app/Contents/ServerRoot/usr/sbin/serveradmin settings dhcp
これをSQLに置き換えるスクリプトを書けば一括で登録できそう。
下記はphpMyAdminで登録したものから、NULLの部分を削ったもの。
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
INSERT INTO `hosts` ( `host_id`, `dhcp_identifier_type`, `dhcp_identifier`, `dhcp_identifier_str`, `ipv4_address`, `ipv4_address_str`, `hostname` ) VALUES ( NULL, '0', UNHEX('08002710df72'), '08:00:27:10:df:72', INET_ATON('192.168.0.83'), '192.168.0.83', 'VM-WinXP' ); |
dhcp_identifier_strとipv4_address_strは直接データベースに追加したカラムである。
phpMyAdmin上で検索がし易かろうと思ったのだ。
当然、kea dhcpはここを参照しない。keaから登録(できるかは知らないが)すると空白となる。ゆえに空白可となっている。
|
1 2 |
dhcp_identifier_str:varchar(17) utf8_general_ci NULL=はい ipv4_address_str:varchar(15) utf8_general_ci NULL=はい |
こんな感じ。
参照したのはこちら。
kryptedさんとこの「Replace the macOS Server DHCP Service with bootp」
しかし、未だデータベースを読んでいるのか判らない……
keaのサイトのドキュメントを探してみた。
kea-dhcp4.confの中を確認する。
“Dhcp4”: {
という定義の下にある
|
1 2 3 4 5 6 7 8 |
"hosts-database": { "type": "mysql", "name": "database name", "user": "user name", "password": "password", "host": "localhost", "port": 3306 }, |
ここで定義されてれば読んでいるんだと確定。
理由は、kea-dhcp4.logで、hosts tableに登録されていないHardware adderessをデータベースに登録したら、ip addressの割り振りが変わったから。
これでdnsもやってくれれば完璧だ!
guest clientに適当な名前もつけてくれれば、尚嬉しい。
勢いに乗ってserver.appのdumpからsql作成用のスクリプト組んじゃった(笑)
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
/* osx server上のdhcp databaseのdumpからkea dhcp databaseのsqlを作成する 純正のtableを拡張(dhcp_identifier_strとipv4_address_str)してます。 コメント化されているものと切り替えてお使いください。 */ $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"; //$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"; // 純正用 $infile = "DHCPsetting.txt"; $outfile = "DHCPsetting.sql"; $file = file ( $infile ); $sqls = array(); $matches = array(); $line = ""; foreach ( $file as $line ) { if ( preg_match ( '#ip_address:_array_index:0 = "([0-9\.]+)"#', $line, $matches ) ) { $ip = $matches[1]; } elseif ( preg_match ( '#en_address:_array_index:0 = "([0-9A-Za-z:]+)"#', $line, $matches ) ) { $hw = $matches[1]; } elseif ( preg_match ( '#static_maps.+name = "([^"]+)"#', $line, $matches ) ) { $name = $matches[1]; $sqls[] = sprintf ( $sql_format, preg_replace ( "#:#", "", $hw ), $hw, $ip, $ip, $name ); // $sqls[] = sprintf ( $sql_format, preg_replace ( "#:#", "", $hw ), $ip, $name ); // 純正用 } } $out = fopen ( $outfile, "w" ); foreach ( $sqls as $line ) { fwrite ( $out, $line ); } |
perlじゃなくてphpなのは趣味。
登録も済んだので、これからはlocal net内の固定アドレス化が復活だ!
Kea DHCPを入れてみた(その1)
昨日入れたKea DHCPを動かしてみた。
うん、設定通りrouter、dns serverと定義されている。問題無いっちゃぁ無い。
“Kea DHCPを入れてみた(その1)” の続きを読む

