dhcp-server
dhcp-server
Important: Assuming there is more than one network interface attached to the system, but you want the DHCP server to only be
started on one of the interfaces, set the DHCP server to start only on that interface as follows.
Step 2: Configuring DHCP Server in CentOS
For starters, to setup a DHCP server, the first step is to create the dhcpd.conf configuration file, and the main DHCP configuration
file is normally /etc/dhcp/dhcpd.conf (which is empty by default), it keeps all network information sent to clients.
However, there is a sample configuration file /usr/share/doc/dhcp*/dhcpd.conf.sample, which is a good starting point for
configuring a DHCP server.
# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf
Now, open the main configuration file and define your DHCP server options:
# vi /etc/dhcp/dhcpd.conf
Start by setting the following global parameters which will apply to all the subnetworks (do specify values that apply to your
scenario) at the top of the file:
5. Now, define a subnetwork; in this example, we will configure DHCP for 192.168.56.0/24 LAN network (remember to use
parameters that apply to your scenario):
host rhel-node {
hardware ethernet 00:f0:m4:6y:89:0g;
fixed-address 192.168.56.105;
}
6. Now start the DHCP service for the mean time and enable it to start automatically from the next system boot, using following
commands:
7. Next, do not forget to permit DHCP service (DHCPD daemon listens on port 67/UDP) as below:
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=dhcp
TYPE=Ethernet
ONBOOT=yes