#author("2020-01-19T16:07:54+09:00","default:nowsky","nowsky") *Kea [#i4d0bcbb] [[ISC Kea DHCP:+https://www.isc.org/kea/]] フリーのDHCPサーバとして利用されているISC DHCP Serverの後継ソフト。 リース情報の保持にRDBも利用出来る様になった上、 REST APIによるアプリケーション制御も出来る様になった。 従来はfailover機能が実装されていなかったが、v1.4.0で実装された。 ~ *インストール [#ia5c5979] &size(16){&font(b){0. 事前準備};}; KeaにはBoostライブラリを利用している為、関連するライブラリを導入しておく。 # zypper install log4cplus log4cplus-devel boost-devel libboost_system-devel # tar zxvf kea-1.6.1.tar.gz # cd kea-1.6.1 # ./configure --prefix=/usr/local/kea-1.6.1 --enable-shell --with-openssl --with-mysql=/usr/bin/mysql_config # make # make install # ln -s /usr/local/kea-1.6.1 /usr/local/kea # ln -s /usr/local/kea/etc/kea /etc/kea ~ ---- &size(16){&font(b){1. 起動準備};}; プログラム起動用のサービスファイルを作成する。 実行ユーザはrootそのままにしておく。必要に応じてパーミッション変更も実施する。 - /usr/lib/systemd/system/kea-ctrl.service [Unit] Description=ISC Kea CTRL Agent Documentation=man:kea-ctrl-agent(8) Wants=network-online.target After=network-online.target time-sync.target [Service] Type=simple Restart=on-failure EnvironmentFile=-/etc/sysconfig/kea ExecStartPre=/usr/local/kea/sbin/kea-ctrl-agent -t ${CONFIG_CTRL} ExecStart=/usr/local/kea/sbin/kea-ctrl-agent -c ${CONFIG_CTRL} ExecReload=/bin/kill -HUP $MAINPID ExecStop=/bin/kill -SIGTERM $MAINPID [Install] WantedBy=kea-dhcp4.service WantedBy=kea-dhcp6.service - /usr/lib/systemd/system/kea-dhcp4.service [Unit] Description=ISC Kea DHCPv4 Server Documentation=man:kea-dhcp4(8) Wants=network-online.target After=network-online.target time-sync.target [Service] Type=simple Restart=on-failure EnvironmentFile=-/etc/sysconfig/kea ExecStartPre=/usr/local/kea/sbin/kea-dhcp4 -t ${CONFIG_DHCP4} ExecStart=/usr/local/kea/sbin/kea-dhcp4 -c ${CONFIG_DHCP4} ExecReload=/bin/kill -HUP $MAINPID ExecStop=/bin/kill -SIGTERM $MAINPID [Install] WantedBy=multi-user.target - /usr/lib/systemd/system/kea-dhcp6.service [Unit] Description=ISC Kea DHCPv6 Server Documentation=man:kea-dhcp6(8) Wants=network-online.target After=network-online.target time-sync.target [Service] Type=simple Restart=on-failure EnvironmentFile=-/etc/sysconfig/kea ExecStartPre=/usr/local/kea/sbin/kea-dhcp6 -t ${CONFIG_DHCP6} ExecStart=/usr/local/kea/sbin/kea-dhcp6 -c ${CONFIG_DHCP6} ExecReload=/bin/kill -HUP $MAINPID ExecStop=/bin/kill -SIGTERM $MAINPID [Install] WantedBy=multi-user.target - /etc/sysconfig/kea ## Type: string ## Default: /usr/local/kea/etc/kea/kea-ctrl-agent.conf # # This is a basic configuration for the Kea Control Agent. # Specify kea-ctrl-agent configuration file. # CONFIG_CTRL="/etc/kea/kea-ctrl-agent.conf" ## Type: string ## Default: /usr/local/kea/etc/kea/kea-dhcp4.conf # # This is a basic configuration for the Kea DHCPv4 server. # Specify kea-dhcp4 configuration file. # CONFIG_DHCP4="/etc/kea/kea-dhcp4.conf" ## Type: string ## Default: /usr/local/kea/etc/kea/kea-dhcp6.conf # # This is a basic configuration for the Kea DHCPv6 server. # Specify kea-dhcp6 configuration file. # CONFIG_DHCP6="/etc/kea/kea-dhcp6.conf" ## Type: string ## Default: /usr/local/kea/var/run # # The value as passed into the build configure script. # That this value may be overridden at runtime by # setting the environment variable KEA_PIDFILE_DIR, # although this is intended primarily for testing purposes. # KEA_PIDFILE_DIR="/var/run" ~ ---- &size(16){&font(b){2. DB準備};}; リース情報の格納にRDBを使う場合はデータベースの作成を行う。 Kea DHCPでは、MySQL・PostgreSQL・Cassandra・LDAPなどを利用可能。 下記はバックエンドにMySQLを利用した場合の設定例 MariaDB [(none)]> create database kea_db; MariaDB [(none)]> create user 'kea_user'@'%' identified by 'kea_pass'; MariaDB [(none)]> grant all on kea_db.* to 'kea_user'@'%'; MariaDB [(none)]> flush privileges; MariaDB [(none)]> quit; # vi /etc/my.cnf --- ※下記を追記 "log_bin_trust_function_creators = 1" # /usr/local/kea/sbin/kea-admin db-init mysql -h 127.0.0.1 -u kea_user -p kea_pass -n kea_db -d /usr/local/kea/share/kea/scripts ~ *コンフィグ [#a2c66b5c] &size(16){&font(b){A. シングル構成・別セグメント待受};}; 詳細は[[マニュアル:+https://kb.isc.org/docs/kea-administrator-reference-manual]]に書かれているので割愛。 下記はクライアントセグメントの外にDHCPサーバを設置し、複数セグメントのDHCPサーバを集約管理する時の設定。 ・DHCPサーバ 構成情報 |ネットワーク |10.0.0.0/24 | |インターフェース|eth0 (1NIC構成)| ・DHCPクライアント IP払出し情報 |ネットワーク |10.10.0.0/24 | |デフォルトルート|10.10.0.254 | |IP払い出し範囲 |10.10.0.100~10.10.0.200| |プライマリDNS |10.0.0.10 | |セカンダリDNS |10.0.0.20 | ・補足 DHCPクライアントとDHCPサーバが別セグメントになり、DHCP DISCOVERがDHCPサーバまで届かなくなるので、 クライアントのデフォルトルートとなるルータに、[[DHCPリレー設定:+http://www.cisco.com/cisco/web/support/JP/docs/CIAN/IOS/IOSSWRels15_1/CG/001/iad_dhcp_rly_agt.html?bid=0900e4b1825ae5ce#44008]]を入れておく。