Good to know : DHCP is the abbreviation of Dynamic Host Configuration Protocol. DHCP is a protocol used for dynamic distribution of IP addresses on computer networks. By using DHCP you can configure the IP address on each device on the computer network automatically. On computer networks that do not implement DHCP, the network administrator must manually configure the IP address on each device, this will of course take more time and is inefficient. Especially on large-scale computer networks.
Configuration
Edit IP Address
nano /etc/network/interfaces
# The primary network interface
auto ens33
iface ens33 inet dhcp
auto ens36
iface ens36 inet static
address 10.1.31.1
network 255.255.255.0
Install Package
apt install isc-dhcp-server -y
Edit File isc-dhcp-server
dhcp conf
nano /etc/dhcp/dhcpd.conf
# A slightly different configuration for an internal subnet.
subnet 10.1.31.0 netmask 255.255.255.0 {
range 10.1.31.2 10.1.31.254;
option domain-name-servers ns1.internal.example.org;
option domain-name "internal.example.org";
option routers 10.1.31.1;
option broadcast-address 10.1.31.255;
default-lease-time 600;
max-lease-time 7200;
}