DHCPサーバをインストール
mint@mint-GK41:~$ sudo apt install isc-dhcp-server
デフォルトの設定内容(有効行のみ)
mint@mint-GK41:~$ grep -v "#" /etc/dhcp/dhcpd.conf
option domain-name "example.org";
option domain-name-servers ns1.example.org, ns2.example.org;
default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;
適当なドメイン名と足りない情報を追加する
mint@mint-GK41:~$ cat /etc/dhcp/dhcpd.conf
option domain-name "home.net";
option domain-name-servers 192.168.1.1;
option routers 192.168.100.254;
default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;
subnet 192.168.100.0 netmask 255.255.255.0 {
range 192.168.100.1 192.168.100.99;
}
mint@mint-GK41:~$
起動する
mint@mint-GK41:~$ sudo systemctl start isc-dhcp-server
何もメッセージ出ない・・・
動作確認(windows11 home) まだ無線AP買ってないのでLANで確認
ちゃんとIPもらえて、通信OK
C:\Users\user>ipconfig /all
Windows IP Configuration
Host Name . . . . . . . . . . . . : note
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
DNS Suffix Search List. . . . . . : home.net
Ethernet adapter イーサネット:
Connection-specific DNS Suffix . : home.net
Description . . . . . . . . . . . : Realtek PCIe GbE Family Controller
Physical Address. . . . . . . . . : C0-18-50-70-1F-6E
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::c8d1:85b9:e47f:9230%9(Preferred)
IPv4 Address. . . . . . . . . . . : 192.168.100.1(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Lease Obtained. . . . . . . . . . : 2022年7月24日 11:27:03
Lease Expires . . . . . . . . . . : 2022年7月24日 11:37:03
Default Gateway . . . . . . . . . : 192.168.100.254
DHCP Server . . . . . . . . . . . : 192.168.100.254
DHCPv6 IAID . . . . . . . . . . . : 213915728
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-2A-13-7C-82-C0-18-50-70-1F-6E
DNS Servers . . . . . . . . . . . : 192.168.1.1
NetBIOS over Tcpip. . . . . . . . : Enabled
自動起動する設定
mint@mint-GK41:~$ sudo systemctl enable isc-dhcp-server.service
Synchronizing state of isc-dhcp-server.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable isc-dhcp-server
mint@mint-GK41:~$
起動中のステータスメモ
mint@mint-GK41:~$ sudo systemctl status isc-dhcp-server
● isc-dhcp-server.service - ISC DHCP IPv4 server
Loaded: loaded (/lib/systemd/system/isc-dhcp-server.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2022-07-24 11:40:57 JST; 10s ago
Docs: man:dhcpd(8)
Main PID: 3538 (dhcpd)
Tasks: 4 (limit: 9224)
Memory: 4.8M
CGroup: /system.slice/isc-dhcp-server.service
└─3538 dhcpd -user dhcpd -group dhcpd -f -4 -pf /run/dhcp-server/dhcpd.pid -cf /etc/dhcp/dhcpd.conf
7月 24 11:40:57 mint-GK41 dhcpd[3538]: in your dhcpd.conf file for the network segment
7月 24 11:40:57 mint-GK41 dhcpd[3538]: to which interface enp3s0 is attached. **
7月 24 11:40:57 mint-GK41 dhcpd[3538]:
7月 24 11:40:57 mint-GK41 dhcpd[3538]: Listening on LPF/enp2s0/84:47:09:11:8c:1d/192.168.100.0/24
7月 24 11:40:57 mint-GK41 sh[3538]: Listening on LPF/enp2s0/84:47:09:11:8c:1d/192.168.100.0/24
7月 24 11:40:57 mint-GK41 sh[3538]: Sending on LPF/enp2s0/84:47:09:11:8c:1d/192.168.100.0/24
7月 24 11:40:57 mint-GK41 sh[3538]: Sending on Socket/fallback/fallback-net
7月 24 11:40:57 mint-GK41 dhcpd[3538]: Sending on LPF/enp2s0/84:47:09:11:8c:1d/192.168.100.0/24
7月 24 11:40:57 mint-GK41 dhcpd[3538]: Sending on Socket/fallback/fallback-net
7月 24 11:40:57 mint-GK41 dhcpd[3538]: Server starting service.
mint@mint-GK41:~$