0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

AlmaLinux DHCP

Posted at

概要

DHCPとは、コンピュータにIpアドレスを自動的に割り振る仕組みです。
クライアントがiPアドレスをリクエストした際に、DHCPサーバがあらかじめ設定されているから、未使用のIPアドレスを一定期間貸し出す。

インストール

DHCPサーバ構成のパッケージは、dhcp-serverになります。

# 事前確認
[admin@almalinux9 ~]$ yum list installed |grep dhcp

# インストール
[admin@almalinux9 ~]$ sudo yum install -y dhcp-server
メタデータの期限切れの最終確認: 0:04:35 前の 2024年02月10日 16時31分52秒 に実施しました。
依存関係が解決しました。
=============================================================================================================================================================
 パッケージ                            アーキテクチャー                 バージョン                                    リポジトリー                     サイズ
=============================================================================================================================================================
インストール:
 dhcp-server                           x86_64                           12:4.4.2-19.b1.el9                            baseos                           1.2 M
依存関係のインストール:
 dhcp-common                           noarch                           12:4.4.2-19.b1.el9                            baseos                           128 k

トランザクションの概要
=============================================================================================================================================================
インストール  2 パッケージ

ダウンロードサイズの合計: 1.3 M
インストール後のサイズ: 4.2 M
パッケージのダウンロード:
(1/2): dhcp-common-4.4.2-19.b1.el9.noarch.rpm                                                                                458 kB/s | 128 kB     00:00
(2/2): dhcp-server-4.4.2-19.b1.el9.x86_64.rpm                                                                                1.8 MB/s | 1.2 MB     00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------
合計                                                                                                                         1.0 MB/s | 1.3 MB     00:01
トランザクションの確認を実行中
トランザクションの確認に成功しました。
トランザクションのテストを実行中
トランザクションのテストに成功しました。
トランザクションを実行中
  準備             :                                                                                                                                     1/1
  インストール中   : dhcp-common-12:4.4.2-19.b1.el9.noarch                                                                                               1/2
  scriptletの実行中: dhcp-server-12:4.4.2-19.b1.el9.x86_64                                                                                               2/2
  インストール中   : dhcp-server-12:4.4.2-19.b1.el9.x86_64                                                                                               2/2
  scriptletの実行中: dhcp-server-12:4.4.2-19.b1.el9.x86_64                                                                                               2/2
  検証             : dhcp-common-12:4.4.2-19.b1.el9.noarch                                                                                               1/2
  検証             : dhcp-server-12:4.4.2-19.b1.el9.x86_64                                                                                               2/2

インストール済み:
  dhcp-common-12:4.4.2-19.b1.el9.noarch                                         dhcp-server-12:4.4.2-19.b1.el9.x86_64

完了しました!

パケットフィルタリング設定

# 現在の利用可能なサービスの確認
[admin@almalinux9 ~]$ sudo firewall-cmd --list-services
cockpit dhcpv6-client ssh

# 設定の追加
[admin@almalinux9 ~]$ sudo firewall-cmd --add-service=dhcp
success

# ルールの保存
[admin@almalinux9 ~]$ sudo firewall-cmd --runtime-to-permanent
success

DHCPサーバの基本設定

IPv4用の設定ファイルは、/etc/dhcp/dhcpd.confですが、インストール後は何も設定がされていない。
そのため、サンプルの設定ファイルが/usr/share/doc/dhcp-server配下にあるのでコピーして編集する。

ちなみに、ファイルの中身を確認すると・・・

/etc/dhcp/dhcpd.conf
[admin@almalinux9 ~]$ sudo cat /etc/dhcp/dhcpd.conf
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp-server/dhcpd.conf.example
#   see dhcpd.conf(5) man page
#

# 設定ファイルの種類
[admin@almalinux9 dhcp-server]$ cd /usr/share/doc/dhcp-server/ && ll
合計 16
-rw-r--r--. 1 root root 5856  9月 27 11:44 dhcp-lease-list.pl
-rw-r--r--. 1 root root 3266 12月 18  2019 dhcpd.conf.example
-rw-r--r--. 1 root root 3367  9月 27 11:44 dhcpd6.conf.example
drwxr-xr-x. 2 root root   70  2月 10 16:36 ldap

設定ファイルのコピー

[admin@almalinux9 ~]$ sudo cp /usr/share/doc/dhcp-server/dhcpd.conf.example /etc/dhcp/dhcpd.conf

後で記載!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?