openSUSE Leap 16

Dnsmasq : DHCP サーバーの設定2025/10/17

 

Dnsmasq 組み込みの DHCP 機能を有効にして DHCP サーバーの設定をします。

[1] Dnsmasq の設定です。
dlp:~ #
vi /etc/dnsmasq.conf
# 175行目 : 貸し出すアドレスの範囲とリース期間を追記

dhcp-range=10.0.0.200,10.0.0.250,12h
# 349行目 : デフォルトゲートウェイ, NTP, DNS, サブネットマスクを定義

dhcp-option=option:router,10.0.0.1
dhcp-option=option:ntp-server,10.0.0.10
dhcp-option=option:dns-server,10.0.0.10
dhcp-option=option:netmask,255.255.255.0
dlp:~ #
systemctl restart dnsmasq

[2] Firewalld を有効にしている場合は、DHCP サービスの許可が必要です。DHCP サーバー は [67/UDP] を使用します。
dlp:~ #
firewall-cmd --add-service=dhcp

success
dlp:~ #
firewall-cmd --runtime-to-permanent

success
[3]

以上で設定完了です。
DHCP クライアントを設定して、正常に IP アドレスが割り当てられるか確認します。

関連コンテンツ