Rocky Linux 9にDHCPサーバをインストールします。
記事の目次
インストール環境を確認する!
インストール環境を確認します。
# hostnamectl Static hostname: vmsins01 Icon name: computer-vm Chassis: vm Machine ID: 3586dd9d0055464c8ea86a45349ecb43 Boot ID: 162c0367f05c41b0a0fc7553dffb0aee Virtualization: oracle Operating System: Rocky Linux 9.1 (Blue Onyx) CPE OS Name: cpe:/o:rocky:rocky:9::baseos Kernel: Linux 5.14.0-162.6.1.el9_1.x86_64 Architecture: x86-64 Hardware Vendor: innotek GmbH Hardware Model: VirtualBox
DHCPサーバをインストールする!
DHCPサーバをRocky Linux 9のリポジトリからインストールします。
# dnf -y install dhcp-server Last metadata expiration check: 1:07:32 ago on Sun 23 Apr 2023 09:59:28 AM JST. Dependencies resolved. ================================================================================================================== Package Architecture Version Repository Size ================================================================================================================== Installing: dhcp-server x86_64 12:4.4.2-17.b1.el9 baseos 1.2 M Installing dependencies: dhcp-common noarch 12:4.4.2-17.b1.el9 baseos 128 k Transaction Summary ================================================================================================================== Install 2 Packages ... Installed: dhcp-common-12:4.4.2-17.b1.el9.noarch dhcp-server-12:4.4.2-17.b1.el9.x86_64 Complete!
DHCPサーバの設定を行う!
DHCPサーバの設定を行う!
# cat <EOF | tee /etc/dhcp/dhcpd.conf # # DHCP Server Configuration file. # see /usr/share/doc/dhcp-server/dhcpd.conf.example # see dhcpd.conf(5) man page # option domain-name "loc.lab4ict.com"; option domain-name-servers ns1.loc.lab4ict.com; default-lease-time 3600; max-lease-time 7200; authoritative; subnet 10.1.0.0 netmask 255.255.0.0 { range dynamic-bootp 10.1.251.1 10.1.251.254; option broadcast-address 10.1.255.255; option routers 10.1.0.1; }
DHCPサーバの起動設定を行う!
DHCPサーバの起動設定を行います。
# systemctl enable --now dhcpd
DHCPサーバの起動状態を確認する!
DHCPサーバの起動状態を確認します。
# systemctl is-enabled dhcpd enabled # systemctl status dhcpd ● dhcpd.service - DHCPv4 Server Daemon Loaded: loaded (/usr/lib/systemd/system/dhcpd.service; enabled; vendor preset: disabled) Active: active (running) since Sun 2023-04-23 11:22:08 JST; 11min ago Docs: man:dhcpd(8) man:dhcpd.conf(5) Main PID: 36269 (dhcpd) Status: "Dispatching packets..." Tasks: 1 (limit: 11062) Memory: 4.6M CPU: 8ms CGroup: /system.slice/dhcpd.service └─36269 /usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid
おわりに
Rocky Linux 9では、DHCPサーバは、Rocky Linux 9のリポジトリからインストールすることができます。
関連記事
参考書籍(Amazon)