How to reserve IP Address in DHCP Server

JHO*_*MAN 7 server networking dhcpd dhcp

I install DHCP Server with https://help.ubuntu.com/lts/serverguide/dhcp.html

but I need to make reserve IP addresses for specific machine (192.168.1.XXX) and further to assign a name to each machine (machine 1 machine 2 machine 3).

My configuration file is as follows.

default-lease-time 600;
max-lease-time 7200;

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.2 192.168.1.249;
option routers 192.168.88.250;
option domain-name-servers 192.168.1.x, 8.8.8.8;
option domain-name "mydomain.lan"; }
Run Code Online (Sandbox Code Playgroud)

This is to replace fortinet service and add hostnames for each IP assigned and have control of them.

If there is any visual alternative (via web) to manage what I need, would be helpful.

Mit*_*tch 11

在此示例中,DHCP 服务器 IP 地址保留将使用 NIC 的 MAC 地址。您需要知道 MAC 地址才能将其添加到 DHCP 配置文件中。(我将在示例中使用虚拟 MAC 地址和 IP 地址)。

要查找 MAC 地址,请使用ifconfig,并查找HWaddr条目

为此,只需按键盘上的Ctrl+ Alt+T即可打开终端。当它打开时,运行以下命令:

sudo nano /etc/dhcp3/dhcpd.conf
Run Code Online (Sandbox Code Playgroud)

并添加以下几行:

host Accountant {
hardware ethernet 00:1F:6A:21:71:3F;
fixed-address 10.0.0.101;
}
Run Code Online (Sandbox Code Playgroud)

保存文件并退出。

现在 DHCP 服务器将始终将 10.0.0.101 分配给 00:1F:6A:21:71:3F MAC 地址。

重新启动 DHCP

service dhcpd restart
Run Code Online (Sandbox Code Playgroud)

或者

sudo /etc/init.d/dhcp3-server restart
Run Code Online (Sandbox Code Playgroud)