DHCP : Configure DHCP Server2025/04/21 |
Configure DHCP ( Dynamic Host Configuration Protocol ) Server to assign IP addresses to client hosts in local network. |
|
[1] | Install and Configure DHCP. On this example, it shows only for IPv4 configuration. |
root@dlp:~#
apt -y install isc-dhcp-server
root@dlp:~#
vi /etc/default/isc-dhcp-server # line 4 : uncomment DHCPDv4_CONF=/etc/dhcp/dhcpd.conf # line 17 : specify interface to listen (replace it to your environment) INTERFACESv4=" enp1s0 "
root@dlp:~#
vi /etc/dhcp/dhcpd.conf # line 10 : specify domain name option domain-name "srv.world" ;
# line 11 : specify nameserver's hostname or IP address option domain-name-servers dlp.srv.world ;
# line 24 : uncomment (this DHCP server to be declared valid) authoritative; # add to last line # specify network address and subnetmask subnet 10.0.0.0 netmask 255.255.255.0 { # specify gateway option routers 10.0.0.1; # specify subnet mask option subnet-mask 255.255.255.0; # specify the range of lease IP address range dynamic-bootp 10.0.0.200 10.0.0.254; } systemctl restart isc-dhcp-server |
[2] | It's possible to see leased IP address in the file below from DHCP Server to DHCP Clients. |
root@dlp:~# ll /var/lib/dhcp total 20 drwxrwxr-x 2 root dhcpd 4096 Apr 21 02:04 ./ drwxr-xr-x 50 root root 4096 Apr 21 02:03 ../ -rw-r--r-- 1 dhcpd dhcpd 939 Apr 21 02:05 dhcpd.leases -rw-rw-r-- 1 root dhcpd 222 Apr 21 02:03 dhcpd.leases~ -rw-r--r-- 1 dhcpd dhcpd 222 Apr 21 02:03 dhcpd6.leases -rw-rw-r-- 1 root dhcpd 0 Apr 21 02:03 dhcpd6.leases~root@dlp:~# cat /var/lib/dhcp/dhcpd.leases # The format of this file is documented in the dhcpd.leases(5) manual page. # This lease file was written by isc-dhcp-4.4.3-P1 # authoring-byte-order entry is generated, DO NOT DELETE authoring-byte-order little-endian; server-duid "\000\001\000\001/\230dGRT\000\204D\251"; lease 10.0.0.250 { starts 1 2025/04/21 02:04:55; ends 1 2025/04/21 02:14:55; cltt 1 2025/04/21 02:04:55; binding state active; next binding state free; rewind binding state free; hardware ethernet 00:0c:29:e5:f5:43; uid "\001\000\014)\345\365C"; set vendor-class-identifier = "MSFT 5.0"; client-hostname "RX-0"; } ..... ..... |
Sponsored Link |