Environment Description: DHCP server system: CentOS5.5 Nic interface: eth0IP address: 192.168.21.136 Gateway: 192.168.21.2 subnet mask: 255.255.255.0DNS: 8.8.88.8.4.4 1. Install and check whether the DHCP service has rpm-qdhcppackagedhcpisnotin
Environment Description:
DHCP server system:CentOS 1, 5.5
Nic interface:Eth0
IP Address:192.168.21.136
Gateway:192.168.21.2
Subnet Mask:255.255.255.0
DNS:8.8.8.8 8.4.4
I. Installation
Check whether the DHCP service is installed
Rpm-q dhcp
Package dhcp is not installed
Yum-y install dhcp
Ii. Configuration
Cp/usr/share/doc/dhcp-3.0.5/dhcpd. conf. sample/etc/dhcpd. conf # copy the profile template
Vi/etc/dhcpd. conf # edit the configuration file
Ddns-update-style interim; # Set DHCP server mode
Ignore client-updates; # disable client updates
Subnet 192.168.21.0 netmask 255.255.255.0 {
Option routers 192.168.21.2; # Set the Gateway
Option subnet-mask limit 255.0; # Set the subnet mask
Option domain-name-servers 8.8.8.8, 8.8.4.4; # Set the dns server address
Range dynamic-bootp 192.168.21.200 192.168.21.210; # Set the IP address lease range of the dhcp server
Default-lease-time 21600; # default lease time
Max-lease-time 43200; # maximum lease time
Hardware ethernet 00: 0C: 29: E2: 82: 5C; # retain the MAC address of the host
Fixed-address 192.168.21.201; # reserve the IP address of the host, that is, bind the IP address to the host
Vi/etc/sysconfig/dhcpd # specify the network interface of the DHCP service
# Command line options here
DHCPDARGS = eth0
3. Start
Service dhcpd start # start The dhcp service
Service dhcpd restart # restart dhcp service
Chkconfig dhcpd on # Set startup
Iv. Test
Set the IP address on the client to be automatically obtained. Restart the client and check that one of the IP addresses ranges from 192.168.21.200 to 192.168.21.210 is successful!
Attachment: dhcpd. conf configuration file in this tutorial
ddns-update-style interim;ignore client-updates;subnet 192.168.21.0 netmask 255.255.255.0 {# --- default gateway option routers 192.168.21.2; option subnet-mask 255.255.255.0;# option nis-domain "domain.org";# option domain-name "domain.org"; option domain-name-servers 8.8.8.8,8.8.4.4; option time-offset -18000; # Eastern Standard Time# option ntp-servers 192.168.1.1;# option netbios-name-servers 192.168.1.1;# --- Selects point-to-point node (default is hybrid). Don't change this unless# -- you understand Netbios very well# option netbios-node-type 2; range dynamic-bootp 192.168.21.200 192.168.21.210; default-lease-time 21600; max-lease-time 43200; # we want the nameserver to appear at a fixed address host ns { next-server marvin.redhat.com; hardware ethernet 00:0C:29:E2:82:5C; fixed-address 192.168.21.201; }}
» Link to this article: http://www.osyunwei.com/archives/1744.html