first assume that the DHCP server IP is 192.168.80.20/24.
1. Installing the DHCP server software
Mount/dev/cdrom/mnt
rpm-ivh/mnt/packages/dhcp-4.1.1-34.p1.el6.i686.rpm
2. Modify the configuration
(1) View file hints cat/etc/dhcp/dhcpd.conf
copy template files to dhcp.conf
Cp/usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample/etc/dhcp/dhcpd.conf
(2) Remove # and Blank lines from dhcpd.conf
Cd/etc/dhcp
Grep-v "#" dhcpd.conf | Grep-v "^$" > Dhcpd.conf.back
Overwrite original file cp Dhcpd.conf.back dhcpd.conf
(3) Modify The dhcpd.conf file configuration
VI dhcpd.conf
In order to keep the address before the #, make it a note, note the end of the sentence plus ";"
Option Domain-name-servers 8.8.8.8,9.9.9.9; Server Dns
Default-lease-time 600;
Subnet 192.168.80.0 netmask 255.255.255.0 { Scope network segment
Range 192.168.80.100 192.168.80.200; Address Pool
Option Domain-name-servers 10.10.10.10,1.1.1.1; Dns
Option routers 192.168.80.1; Gateway
Default-lease-time 600; Lease Time
}
# host prtsvt{
#hardware Ethernet;
# fixed-address 192.168.80.188;
}
Save.
3. start The DHCP service
Service DHCP Start
If there is a definite indication of success
In the event of a failure, view the log and modify the configuration content as above
Cat/var/log/messages
on the real machine will The IP address is set to be automatically obtained, and the IP address can be tested for distribution .
4. Test The DHCP reserved block.
Vi/etc/dhcp/dhcpd.conf
Remove the # before the reserved block
Option Domain-name-servers 8.8.8.8,9.9.9.9; Server Dns
Default-lease-time 600;
Subnet 192.168.80.0 netmask 255.255.255.0 { Scope network segment
Range 192.168.80.100 192.168.80.200; Address Pool
Option Domain-name-servers 10.10.10.10,1.1.1.1; Scope DNS
Option routers 192.168.80.1; Gateway
Default-lease-time 600; Lease Time
}
Host prtsvt{
Hardware Ethernet The Mac address of the real computer network card ;
Fixed-address 192.168.80.188; Suppose the reserved address is 192.168.80.188
}
Note change the Mac address "-" to ":"
Save, restart DHCP service : Service DHCP restart
Appear identified as successful
A failure occurs, review the log, modify the configuration as above.
Restart the network card of the real machine to see if the block address is reserved.
This article is from the "Ne Road" blog, please be sure to keep this source http://332162926.blog.51cto.com/8831013/1441080
Linux Build DHCP server