====== DHCPサーバー ======
===== パッケージインストール =====
$ sudo dnf install dhcp
===== DHCP サーバーの設定 =====
====設定ファイルのバックアップ ====
$ sudo cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.org
サンプルを元に修正する場合は、以下のファイルをコピーする。
$ sudo cp /usr/share/doc/dhcp-server/dhcpd.conf.example /etc/dhcp/dhcpd.conf
==== 設定ファイルの編集 ====
$ sudo vi /etc/dhcp/dhcpd.conf
#
# DHCP Server Configuration file.
#
ddns-update-style interim;
ignore client-updates;
subnet 192.168.1.0 netmask 255.255.255.0 {
authoritative;
option routers 192.168.1.254;
option subnet-mask 255.255.255.0;
option domain-name "fireball.local";
option domain-name-servers blue-dc, blue-ns, tomoyan-wrt;
option ntp-servers blue-dc;
option time-offset 32400; # Japan Standard Time
# option netbios-name-servers blue-dc;
# option netbios-node-type 2;
option root-path "/opt/ltsp/i386";
if substring( option vendor-class-identifier, 0, 9 ) = "PXEClient" {
filename "/ltsp/i386/pxelinux.0";
} else {
filename "/ltsp/i386/nbi.img";
}
next-server 192.168.1.15;
range 192.168.1.150 192.168.1.199;
range dynamic-bootp 192.168.1.91 192.168.1.100;
default-lease-time 21600;
max-lease-time 43200;
}
#host blue-work-sv {
# hardware ethernet 52:54:00:1D:7E:B2;
# fixed-address 192.168.1.80;
#}
==== 設定ファイルのチェック ====
$ sudo dhcpd -t
Internet Systems Consortium DHCP Server 4.3.6
Copyright 2004-2017 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
ldap_gssapi_principal is not set,GSSAPI Authentication for LDAP will not be used
Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified in the config file
Config file: /etc/dhcp/dhcpd.conf
Database file: /var/lib/dhcpd/dhcpd.leases
PID file: /var/run/dhcpd.pid
Source compiled to use binary-leases
===== firewallの設定 =====
dhcpサービスを許可する。
$ sudo firewall-cmd --permanent --add-service=dhcp
success
設定を反映する。
$ sudo firewall-cmd --reload
success
設定を確認する。(dhcpが含まれていること)
$ sudo firewall-cmd --list-services
dhcp dhcpv6-client ipp-client mdns
===== サービス自動起動設定 =====
$ sudo systemctl enable dhcpd.service
===== サービス起動 =====
$ sudo systemctl start dhcpd.service
===== 参考文献 =====
[[http://linuxjm.sourceforge.jp/html/dhcp2/man5/dhcpd.conf.5.html|Man page of dhcpd.conf]]\\