How to install DHCP Server on FreeBSD
This tutorial would let you learn the use of DHCP in practice as real world setup on production systems.
What is DHCP
DHCP, the Dynamic Host Configuration Protocol, describes the means by which a system can connect to a network and obtain the necessary information for communication upon that network. All information here regarding dhclient is for use with either of the ISC or OpenBSD DHCP clients. The DHCP server is the one included in the ISC distribution.
DHCP functioned as Automatic Network Configuration written by Greg Sutter.
When the DHCP client is executed on client machine, it begins broadcasting requests from configuration information via UDP port 68 as default.
Preparation
This setup would be based on FreeBSD 12.2 which should be working for other version with minimal adjustment.
Know the host name and ethernet interface:
Hostname: serve1.unixcop.com
Interface: em0
Host IP address: 192.168.0.11/24
IP address range: 192.168.0.100 192.168.0.199
Internet gateway: 192.168.0.1
DNS server/s: 192.168.0.1, 192.168.0.2, 192.168.0.3
Required package and options/dependencies:
sic-dhcp44-server
gmak, gettext-runtime, perl5
It would be necessarily to update all the ports by portsnap
DHCP Server Installation
Hit OK after adjusted
gmake build options required to build isc-dhcp44-server hit OK to accept default options gettext-runtime build options required to build isc-dhcp44-server hit OK to accept default options perl5 build options required to build isc-dhcp44-server hit OK to accept default options
Configuration files and directory
This setup would required to modify some of the files as detailed below.
System configuration
To save and quit vi editing interface: hit ESC button on the keyboard following by :wq
Configuring the DHCP Server
Check default configuration after installed DHCP server
Create DHCP scoop
Modify domain-name and domain-name-server at the top of the file.
Add the DHCP scoop for the decided networks at the bottom of the file.
To save and quit vi editing interface: hit ESC button on the keyboard following by :wq
To enable DHCP Server to start with system
To save and quit vi editing interface: hit ESC button on the keyboard following by :wq
To start the DHCP Server without restarting the system
Setup verification
At the server console check if the DHCP Service is running and released IP addresses.
Output status of running DHCP Server as pid 24028 DHCP Released IP Addresses as 192.168.0.198 and 192.168.0.199
At the client side, it would required to setup as DHCP Client as may refer to the screenshot below for the computer with Microsoft Windows 10 and Ubuntu Linux.
IPv4 setup for DHCP client (Microsoft Windows 10) IP Assigned by the DHCP Server (Microsoft Windows 10) IPv4 setup for DHCP client (Ubuntu 20.04.2.0 LTS) IP Assigned by the DHCP Server (Ubuntu 20.04.2.0 LTS)
Conclusion
This was minimal setup as per required to start and run the DHCP Server without DNS Authority update nor dynamic update to the DNS records.
Источник: