How to Setup A DHCP Server
(VM Version)
(VM Version)
- DHCP automatically gives IP addresses to clients who are requesting for an IP.
- It is a centralized IP Address management
- DHCP Prevent any IP address conflicts and help to converse the use of client IP address on the network
- DHCP also help reduces the complexity and amount of administrative work by assigning TCP/IP configuration
Step 1: Search for DHCP-Server on Linux
- dnf search dhcp-server
Step 2: Install the latest version of DHCP Server
- dnf install dhcp-server -y
Step 3: Configure the DHCP Server
- cp /usr/share/doc/dhcp-server/dhcpd.conf.example /etc/dhcp/dhcpd.conf
(Copy the example file configuration to use as the DHCP Server)
- Afterwards open the copied version vim /etc/dhcp/dhcpd.conf
To Look for this part in the configuration file to be able to setup the subnet, netmask, and its range to be used by other devices
Step 4: Restart the DHCP after configuration
- systemctl restart dhcpd
Step 5: Apply firewall for dhcp
- firewall-cmd –add-service=dhcp –-permanent
- firewall-cmd –reload
Step 6: Enable DHCP 😊
- systemctl enable –-now dhcpd
Step 7: Display the log to view for any device requesting for IP from DHCP (optional)
Any device that requests an IP from DHCP Server will be shown in the log
- tail -f /var/log/boot.log
Step 8: Setup DHCP Client site
- yum install dhclient*
Step 9: Setup client’s profile
- cd /etc/sysconfig/network-scripts/ifcfg-Profile_1
Step 10: Restart the client. To make sure it is refreshed
- systemctl restart NetworkManager
Step 11: Run DHCP Client
- dhclient
Step 12: Check IP output of DHCP Client
- ifconfig enp0s3
Once done with all the steps above , just create the network with auto IP on client side and it will get its IP from DHCP automatically