DHCP服务器的配置
--------------------------------------------
步骤一:
将虚拟机网卡调为虚拟网段,配置DHCP服务器的IP地址
[root@dhcp ~]# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:0C:29:58:BF:1C 
          inet addr:192.168.1.254  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe58:bf1c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:90038 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1619 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:106213353 (101.2 MiB)  TX bytes:172952 (168.8 KiB)
          Interrupt:59 Base address:0x2024

[root@dhcp ~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
------------------------------------------------------------------------------

步骤二:
根据要求安装DHCP服务器所需软件包
[root@dhcp ~]# rpm -q dhcp
dhcp-3.0.5-23.el5   //此处显示表明DHCP软件包已经安装,如未显示任何内容,需手动安装
安装方式如下:
[root@dhcp ~]# rpm -q dhcp
package dhcp is not installed //此处显示表明DHCP软件包未安装
1、挂载光
[root@dhcp ~]# mount /dev/cdrom /media/
mount: block device /dev/cdrom is write-protected, mounting read-only
2、用命令手动安装DHCP
[root@dhcp ~]# rpm -ivh /media/Server/dhcp-3.0.5-23.el5.i386.rpm
warning: /media/Server/dhcp-3.0.5-23.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:dhcp                   ########################################### [100%]
[root@dhcp ~]# rpm -q dhcp
dhcp-3.0.5-23.el5
---------------------------------------------------------------

步骤三:
产生DHCP服务器配置文件
[root@dhcp ~]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
cp:是否覆盖“/etc/dhcpd.conf”? y

----------------------------------------------
步骤四:
根据要求配置/etc/dhcpd.conf配置文件
[root@dhcp ~]# vi /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;

subnet 192.168.1.0 netmask 255.255.255.0 {

# --- default gateway
 option routers   192.168.1.1;
 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,4.4.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.1.128 192.168.1.254;
 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 12:34:56:78:AB:CD;
  fixed-address 207.175.42.254;
 }
}
========================================================================
步骤五:启动DHCP服务器
[root@dhcp ~]# service dhcpd start
启动 dhcpd:                                               [确定]
[root@dhcp ~]# netstat -anpu |grep dhcp
udp        0      0 0.0.0.0:67                  0.0.0.0:*                               14443/dhcpd

------------------------------------
步骤六:测试

================
步骤七:让XP客户端自动获取192.168.1.188
1.先得到XP的MAC地址:00:0C:29:1F:20:22
2.修改DHCP服务器配置文件,/etc/dhcpd.conf
[root@dhcp ~]# vi /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;

subnet 192.168.1.0 netmask 255.255.255.0 {

# --- default gateway
 option routers   192.168.1.1;
 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,4.4.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.1.128 192.168.1.254;
 default-lease-time 21600;
 max-lease-time 43200;

 # we want the nameserver to appear at a fixed address
 host xp {
  hardware ethernet 00:0C:29:1F:20:22;  //修改此行
  fixed-address 192.168.1.188;  //修改此行
 }
}
=====================================================
[root@dhcp ~]# service dhcpd restart
关闭 dhcpd:                                               [确定]
启动 dhcpd:                                               [确定]

测试:

00 0C 29 9D 74 27