(01)Install ISC DHCP or dnsmasq
Linux
1# Option A — ISC DHCP (Ubuntu)2sudo apt-get install -y isc-dhcp-server3 4# Option B — dnsmasq (lightweight, DNS+DHCP)5sudo apt-get install -y dnsmasq6 7# RHEL / Fedora8sudo dnf install -y dhcp-serverAutomatic IP address assignment for network clients
What is this?
DHCP automatically assigns IP addresses to devices on your network so they can connect.
Where to create or edit the main configuration — paths below match the setup steps.
/etc/dhcp/dhcpd.confLocation: ISC DHCP server
Subnets, ranges, and options
Step 01
1# Option A — ISC DHCP (Ubuntu)2sudo apt-get install -y isc-dhcp-server3 4# Option B — dnsmasq (lightweight, DNS+DHCP)5sudo apt-get install -y dnsmasq6 7# RHEL / Fedora8sudo dnf install -y dhcp-serverStep 02
1sudo nano /etc/dhcp/dhcpd.conf2 3# Example:4default-lease-time 600;5max-lease-time 7200;6authoritative;7 8subnet 192.168.1.0 netmask 255.255.255.0 {9 range 192.168.1.100 192.168.1.200;10 option routers 192.168.1.1;11 option domain-name-servers 192.168.1.10, 8.8.8.8;12 option domain-name "example.com";13}14 15# Set interface in /etc/default/isc-dhcp-server:16# INTERFACESv4="eth0"17 18sudo systemctl restart isc-dhcp-server1sudo nano /etc/dnsmasq.conf2 3interface=eth04dhcp-range=192.168.1.100,192.168.1.200,255.255.255.0,12h5dhcp-option=3,192.168.1.16dhcp-option=6,192.168.1.107domain=example.com8 9sudo systemctl restart dnsmasqStep 03
1cat /var/lib/dhcp/dhcpd.leases2sudo journalctl -u isc-dhcp-server -f3# On client: sudo dhclient -v eth0Step 04
1# In dhcpd.conf:2host webserver {3 hardware ethernet 00:11:22:33:44:55;4 fixed-address 192.168.1.50;5}6 7sudo systemctl restart isc-dhcp-server