Configure DHCP Server Using Webmin
Dynamic Host Configuration Protocol (DHCP) is a client/server protocol that automatically provides an Internet Protocol (IP) host with its IP address and other related configuration information such as the subnet mask and default gateway.
In our previous article, you have setup your DNS Server using Webmin, refer below link for more information.
In this article We will seen how to configure DHCP Server Using Webmin(web-based interface). Webmin tool offer to new system administrators to perform all system management task from via a web browser, Instead of using the command line console or terminal. You can also manage a system from the console or remotely.
My Network Setup:
DHCP server ip address and hostname(RHEL7): 192.168.1.1 (server1)
Network name: IntranetDHCP
Network address: 192.168.1.0
Address range: 192.168.1.210 – 192.168.1.230 (Range of DHCP server gives 20 IPs)
Default lease time: 86400sec (24 hr.)
Maximum lease time:172800sec (48 hr.)
server name: server1
Default routers: 192.168.1.1
Broadcast address: 192.168.1.255
DNS servers: 192.168.1.10 184.108.40.206
192.168.1.10 -> DNS Server Local (our own DNS Server, within our network)
220.127.116.11 -> Google Public DNS
Step by Step configuration of DHCP Server Using Webmin
1) Setting up Webmin.
As previous, we have seen how to configure Webmin on Centos/RHEL7 systems, refer below link.
2) Install the package for DHCP using Webmin.
After Log into Webmin, First we need to search “DHCP Server” and install the DHCP Server Packages, refer below screen shots.
After search “DHCP Server”, Click on “Click here” option to downloaded the DHCP server Packages using YUM. If you are not configured the YUM server, refer the link.(Configure the Yum Server in Centos7/RHEL7/Fedora22)
On Below screenshot, The DHCP Packages can be automatically installed by Webmin.
Note: If you already installed the DHCP packages, then there is no need to perform above steps. Similarly you Go to Servers, and then click on “DHCP Server”.
3) Create a new subnet.
Now Go to Servers, then click on “DHCP Server” and Click on “Add a new subnet”.
Enter the subnet description (In our case we are using IntranetDHCP). For the subnet you can provide the Network address, Netmask and Address range of DHCP Server. You can change the Default and Maximum lease time(In our case we are using 24 hr. and 48 hr. respectively) and Click “save” button, refer below screenshot.
4) Edit DHCP Client options.
Click on “Edit client options”, It will apply to all subnets, shared networks, hosts and groups. refer below screen shot.
On the next Step, You will add the Default routers, broadcast address and DNS Server and select “interim” option from Dynamic DNS update style. It will apply to subnet(i.e IntranetDHCP) which we have created above, refer below screenshot.
Configuration of DHCP Server is over, now start the DHCP service.
5) Check the status of DHCP service and make the service enable even after reboot of the server.
#systemctl status <service name> This command used for check the status of DHCP service.
[root@server1 ~]# systemctl status dhcpd dhcpd.service - DHCPv4 Server Daemon Loaded: loaded (/usr/lib/systemd/system/dhcpd.service; enabled) Active: active (running) since Fri 2016-12-30 04:49:34 EST; 10s ago Docs: man:dhcpd(8) man:dhcpd.conf(5) Main PID: 1270 (dhcpd) CGroup: /system.slice/dhcpd.service └─1270 /usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid Dec 30 04:49:34 server1 systemd: Started DHCPv4 Server Daemon. Dec 30 04:49:35 server1 dhcpd: Internet Systems Consortium DHCP Server 4.2.5 Dec 30 04:49:35 server1 dhcpd: Copyright 2004-2013 Internet Systems Consortium. Dec 30 04:49:35 server1 dhcpd: All rights reserved. Dec 30 04:49:35 server1 dhcpd: For info, please visit https://www.isc.org/software/dhcp/ Dec 30 04:49:35 server1 dhcpd: Not searching LDAP since ldap-server, ldap-port and ldap-base-dn were not specified i...ig file Dec 30 04:49:36 server1 dhcpd: Wrote 2 leases to leases file. Dec 30 04:49:36 server1 dhcpd: Listening on LPF/enp0s3/08:00:27:35:17:7c/192.168.1.0/24 Dec 30 04:49:36 server1 dhcpd: Sending on LPF/enp0s3/08:00:27:35:17:7c/192.168.1.0/24 Dec 30 04:49:36 server1 dhcpd: Sending on Socket/fallback/fallback-net Hint: Some lines were ellipsized, use -l to show in full. [root@server1 ~]#
And # systemctl enable <service name> This command used for enable the service after reboot of the server.
[root@server1 ~]# systemctl enable dhcpd ln -s '/usr/lib/systemd/system/dhcpd.service' '/etc/systemd/system/multi-user.target.wants/dhcpd.service' [root@server1 ~]#
9) Allow DHCP service on firewall.
[root@server1 ]# firewall-cmd --permanent --add-service=dhcp success [root@server1 ]# firewall-cmd --reload success [root@server1 ]#
Hope this post will help Linux/Unix beginners. Please share you feedback and Comments.!!!