下面是結合dhcpd.conf的文本詳細介紹:ddns-update-style interim;.......過渡性DHCP-DNS互動更新模式.一般不修改ignore client-updates; ........不允許各個客戶端更新.一般不修改subnet 192.168.1.0 netmask 255.255.255.0 { ........聲明子網及子網掩碼# --- default gatewayoption routers192.168.1.1; ................為客戶端設置默認網關option subnet-mask255.255.255.0; ...............為客戶端設置子網掩碼option nis-domain"domain.org"; .........設置網路信息服務(NIS)域的名稱option domain-name"domain.org"; .......網路的域名option domain-name-servers192.168.1.1; ........設置DNS伺服器的IP 地址option time-offset-18000;# Eastern Standard Time .......偏移時間#option ntp-servers192.168.1.1; ..........網路時間伺服器(NTP)的IP地址#option netbios-name-servers192.168.1.1; ..........WINS伺服器地址# --- Selects point-to-point node (default is hybrid). Don't change this unless# -- you understand Netbios very well#option netbios-node-type 2; .............netbios節點類型range dynamic-bootp 192.168.0.128 192.168.0.200; .......動態的地址池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:A7:CF:85; .......要綁定的DHCP客戶機的MAC地址fixed-address 192.168.1.1; .........綁定MAC地址的主機的對應IP地址}} 安裝DHCP伺服器,查看是否已經安裝了DHCP軟體包,查看的方法是在終端下輸入【rpm -qa | grep dhcp】命令.如果安裝了則會顯示相關的信息,若無則會顯示「rpmq: no arguments given for query」.將CentOS 5.4的光碟鏡像放入光碟機,進入光碟CentOS目錄下找到dhcp*.*的相關軟體包,其中dhcp-* 為DHCP伺服器的軟體包,dhcp-devel-* 為DHCP開發工具,可選.安裝 dhcp-3.0.5-21.el5.i386.rpm 的軟體包.安裝成功后的結果如圖 1所示.(安裝命令:#rpm -ivh dhcp-3.0.5-21.el5.i386.rpm,另外也可以使用yum安裝,命令:yum install dhcpd*) 圖1DHCP軟體安裝完成後,通過複製樣本文件/usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample文件到/etc/目錄下,已得到dhcpd.conf文件,然後修改文件,完成DHCP伺服器的配置.配置文件詳細如下:ddns-update-style interim;ignore client-updates;subnet 192.168.1.0 netmask 255.255.255.0 { # --- default gatewayoption routers192.168.1.1;option subnet-mask255.255.255.0;option nis-domain"guoguang.com";option domain-name"guoguang.com";option domain-name-servers192.168.1.1;option time-offset-18000;# Eastern Standard Time#option ntp-servers192.168.1.1; #option netbios-name-servers192.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.10 192.168.1.100;default-lease-time 21600;max-lease-time 43200;# we want the nameserver to appear at a fixed addresshost ns {next-server marvin.redhat.com;hardware ethernet 12:34:56:78:AB:CD;fixed-address 207.175.42.254;}}DHCP客戶下查看DHCP伺服器是否已經正常工作了.以下以Windows XP為客戶機,使用ipconfig /release和ipconfig /renew分別釋放和獲取IP地址,結果如圖2所示.(伺服器的IP地址為:192.168.1.2) 圖2配置Linux客戶機的方法是修改/etc/sysconfig/network-scrits下的ifcfg-eth0文件,把 "BOOTPROTO"修改為"BOOTPROTO=dhcp"(如果沒有就在網卡名稱下面添加一行)另外,當DHCP伺服器為某個DHCP客戶機提供租約后,在/var/lib/dhcpd/dhcpd.leses文件中保存已經出租的IP地址信息.# All times in this file are in UTC (GMT), not your local timezone. This is# not a bug, so please don't ask about it. There is no portable way to# store leases in the local timezone, so please don't request this as a# feature. If this is inconvenient or confusing to you, we sincerely# apologize. Seriously, though - don't ask.# The format of this file is documented in the dhcpd.leases(5) manual page.# This lease file was written by isc-dhcp-V3.0.5-RedHatlease 192.168.1.100 { starts 5 2010/04/16 11:21:44; ends 5 2010/04/16 17:21:44; binding state active; next binding state free; hardware ethernet 00:0c:29:2e:99:db; uid " 01 00 14).231333"; client-hostname "centOS-XP";}lease 192.168.1.99 { starts 5 2010/04/16 11:50:02; ends 5 2010/04/16 17:50:02; binding state active; next binding state free; hardware ethernet 00:0c:29:1b:ac:19;}從配置文件中可以看出DHCP伺服器已經有租賃的兩個IP給兩台計算機.