安装环境:redhat linux as 4 2.6.9  
dhcp 是在安装系统的时候就安装上服务了,也可以自己下载手工编译安装。
我的dhcp配置文件在/etc/dhcpd.conf, 一下就dhcp实例解释:
ddns-update-style interim;

  
ignore client-updates;

  
subnet 192.168.1.0 netmask 255.255.255.0 {

  
# --- default gateway

  
option routers 192.168.1.202;

  
option subnet-mask 255.255.255.0;

  
# option nis-domain "uc88.domain";

  
option domain-name "uc88.domain";

  
option domain-name-servers 202.96.128.68,192.168.25.15;

  
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.100 192.168.1.254;

  
default-lease-time 259200;

  
max-lease-time 518400;

  
# 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;

  
# }

  
}

  上面的意思是:

255.255.255.0作为子网掩码,用192.168.1.255作为广播地址,用192.168.1.202作为

  默认网关,用202.96.128.68 and 192.168.25.15作为DNS服务器 将分配地址的范围是:192.168.25.100-192.168.25.254

  保存退出


大多数情况下,DHCP的安装不创建一个dhcpd.leases 文件,在你启动DHCP服务器之前,你必须创建空文件 dhcpd.leases

  
#touch /var/state/dhcp/dhcpd.leases

  为启动DHCP服务器,简单地打入 /usr/sbin/dhcpd 或者用#ntsysvDHCP服务自动启动


  这将启动dhcpdeth0设备上,如果你想在eth1设备上启动dhcpd,则

  #/usr/sbin/dhcpd eth1

Redhat使用dhcpd进程提供DHCP服务,启动时dhcpd自动读它的配置文件/etc/dhcpd.confdhcpd将客户的租用信息保存在/var/state/dhcp/dhcpd.leases文件中,该文件不断被更新,从这里面可以查到IP地址分配的情况。

default-lease-time 默认租期时间;
max-lease-time
用户可以获得的最长租期时间。

option routers 192.168.100.254; 默认路由
option domain-name-servers 202.102.134.68; DNS
服务器
subnet定义了网络的地址,然后option routers定义了网关地址;subnet-mask定义子网掩码;broadcast-address定义广播地址;domain-name-servers定义DNS NAMESERVER的地址;dynamic-bootp是给客户端分配的地址,定义的是192.168.0.1-- 192.168.0.255整个网段地址