How to reserve IP Address in DHCP Server
In this example the DHCP server IP address reservation will use the NIC's MAC Address. You need to know the MAC address to add it to DHCP configuration file. (I will be using a dummy MAC address and IP address in the example).
To find the MAC address use ifconfig
, and look for the HWaddr
entry
To do so, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:
sudo nano /etc/dhcp3/dhcpd.conf
and add the following lines:
host Accountant {
hardware ethernet 00:1F:6A:21:71:3F;
fixed-address 10.0.0.101;
}
Save file and exit.
Now the DHCP server will always assign 10.0.0.101 to the 00:1F:6A:21:71:3F MAC address.
Restart DHCP
service dhcpd restart
or
sudo /etc/init.d/dhcp3-server restart
Related videos on Youtube
JHOSMAN
Updated on September 18, 2022Comments
-
JHOSMAN over 1 year
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"; }
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.
-
JHOSMAN over 10 yearsSo if I have it clear, in fact that it makes my Fortinet device, but want to be able to further identify the MAC address to assign its hostname
-
Mitch over 10 yearsAre you asking if you have to know the MAC address of all devices that you need to reserve and IP for?
-
JHOSMAN over 10 yearsThere are many machines that I administer, it would be easier if you could put an alias or hostname to search for them and not a MAC address.
-
JHOSMAN over 10 yearsIt's possible to my question? ** host NAMEHOST { ... }**
host HSLABTEACHER01 { hardware ethernet 00:25:64:be:3f:48; fixed-address 192.168.1.3; } host ESLABTEACHER01 { hardware ethernet 00:25:64:c2:c4:d7; fixed-address 192.168.1.5; } host NOTE2 { hardware ethernet e0:cb:4e:37:2b:92; fixed-address 192.168.1.4; } host ACCOUNTANT { hardware ethernet 44:87:fc:95:de:3f; fixed-address 192.168.1.6; } host SECRETARY { hardware ethernet 00:26:2d:2e:19:c1; fixed-address 192.168.1.7; }
-
Mitch over 10 yearsYou may want to take a look at DHCP
-
Qian Chen almost 9 yearsOther than IP, what if I need to set mask, gw, add route, can I do all of these here? Thanks.
-
Mitch almost 9 years@ElgsQianChen You sure can.
-
bgStack15 over 3 yearsSometimes, a pool is just not good enough. You need to narrow down a single IP address for a single client, without the ability to adjust the client (I'm looking at you, Chromecast).