Setup DHCP Server in Linux

by | Jan 14, 2015 | RHEL / CentOS

Its easy to setup DHCP server in Linux with full control over the IP’s and what IP’s are assigned to client hosts. We would be using DHCP package via YUM for this setup. DHCP is used for dynamic assinging of IP addresses for the clients in a network. First of all we would install the dhcp package.

# yum -y install dhcp

Now we need top edit the dhcpd.conf file with the appropriate networks and subnets.

Edit dhcpd.conf

# vi /etc/dhcp/dhcpd.conf 
ddns-update-style none;
ignore client-updates;
subnet 10.98.220.0 netmask 255.255.255.0 {
# --- default gateway
        option routers                  10.98.220.1; (Gateway IP)
        option subnet-mask              255.255.255.0;
        option domain-name              "pps.local";
        option domain-name-servers      10.199.100.101; (DNS Server IP)
        range dynamic-bootp 10.98.220.200 10.98.220.254; -- Range of IP's for the Network
        default-lease-time 3600;
        max-lease-time 7200;
        allow booting; (this is if you are using PXE boot)
        allow bootp; (this is if you are using PXE boot)
        next-server 10.98.220.100;(this is if you are using PXE boot)
        filename "pxelinux.0"; (Only used if you are using PXE boot)
}

Save and quit the file.

Restart the dhcpd service

# service dhcpd restart

Make sure DHCP service is enabled at runtime

# chkconfig dhcpd on

If you encounter any errors during the process, let us know via Contact Us and will get it resolved promptly.

Related Articles….