Setup DHCP Server in Linux

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 netmask {
# --- default gateway
        option routers        ; (Gateway IP)
        option subnet-mask    ;
        option domain-name              "pps.local";
        option domain-name-servers; (DNS Server IP)
        range dynamic-bootp; -- 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;(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.

Linux Related Articles . . .