从书上学来的,所以是转载了
 
[root@wbk ~]# cp -p /usr/share/doc/dhcp-3.0.1/dhcpd.conf.sample  /etc/dhcpd.conf  //默认DHCP主配置文件dhcpd.conf没有在/etc/下面,需要复制模板到/etc/下,可以使用find / -name dhcpd.conf.sample /etc/
[root@wbk ~]# cat /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
 
subnet 192.168.0.0 netmask 255.255.255.0 {    //用户可以用subnet语句通知DHCP服务器,把服务器可以分配的IP地址范围限制在规定的子网内。Subnet语句包含了表示子网掩码的netmask
 
# --- default gateway
        option routers                  192.168.0.1;       //设置网关和路由器的IP地址
        option subnet-mask              255.255.255.0;     //设置子网掩码
 
        option nis-domain               "domain.org";
        option domain-name              "domain.org";     //设置DNS域名
        option domain-name-servers      192.168.1.1;     //设置DNS服务器的IP地址(可多个)
 
        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.0.128 192.168.0.254;      //通过range语句,可以指定动态分配给库互动的IP地址范围。在range语句中需要知道地址段的首地址和尾地址(可设多个范围)
        default-lease-time 21600;    //指定客户端IP地址默认租用的时间长度是多少(以秒为单位)
        max-lease-time 43200;      //设置客户最长租用IP地址时间(以秒为单位)
 
        # we want the nameserver to appear at a fixed address
        host ns {             //给某些主机绑定固定IP(可设置多个)
                next-server marvin.redhat.com;     //设置用于定义服务器从影到文件装副的主机名,一般不用(仅用于设置无盘工作站)
                hardware ethernet 12:34:56:78:AB:CD;   //需设置固定IP的网卡的MAC地址
                fixed-address 207.175.42.254;       //对指定的MAC地址分配IP地址
        }
}