Step‑by‑Step Guide to Installing a DHCP Server on CentOS 6.5
This article explains DHCP fundamentals, its four‑stage broadcast workflow, allocation methods and advantages, then provides a complete CentOS 6.5 environment setup with commands, configuration file edits, and client testing to help you deploy a DHCP server efficiently.
Overview
DHCP (Dynamic Host Configuration Protocol) is commonly used in large LAN environments to centrally manage and assign IP addresses, gateway addresses, DNS server addresses, thereby improving address utilization.
Working Principle
DHCP operates through four broadcast phases: DISCOVER, OFFER, REQUEST, and ACK. A client without an IP broadcasts a DISCOVER message; any DHCP server can respond with an OFFER. The client selects an OFFER (usually the first received) and broadcasts a REQUEST to confirm the chosen server. The server finalizes the assignment with an ACK, delivering the IP, subnet mask, gateway, and DNS information. Renewal follows a similar broadcast process, with ACKs confirming continued use or NACKs triggering a new allocation cycle.
Allocation Methods
Automatic allocation: the assigned IP is used permanently.
Manual allocation: the DHCP administrator explicitly assigns a specific IP.
Dynamic allocation: the IP is released after use and can be reassigned to other clients.
Advantages
Reduces administrator workload.
Prevents IP address conflicts.
When the network changes its address range, individual client reconfiguration is unnecessary.
Improves IP address utilization.
Facilitates client configuration.
Address Information Distributed by DHCP
Client IP address and subnet mask.
Network address and broadcast address.
Default gateway address.
DNS server addresses.
Experimental Environment
Operating system: CentOS 6.5
Host IP address: 192.168.1.20
RPM package: dhcp-4.1.1-38.P1.el6.centos.x86_64.rpm
Setup Steps
(1) Install the DHCP service package on the server.
cd /mnt/sr0/Packages/ rpm -ivh dhcp-4.1.1-38.P1.el6.centos.x86_64.rpm(2) View the main configuration file.
vim /etc/dhcp/dhcpd.conf(3) Copy the sample configuration and edit it.
cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf vim /etc/dhcp/dhcpd.conf(4) Test the configuration on a client machine.
vim /etc/sysconfig/network-scripts/ifcfg-eth0(5) Assign a static IP to a specific host.
First, obtain the client’s MAC address.
Then edit the server’s dhcpd.conf to add a host reservation.
vim /etc/dhcp/dhcpd.confSigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
