首先安装dhcp-3.0.5-7.el5.i386.rpm,
配置文件是/etc/dhcpd.conf,
租约数据库文件是/var/lib/dhcpd/dhcpd.leases,
[root@mailsvr1 ~]# vi /etc/dhcpd.conf
里面没什么,
see /usr/share/doc/dhcp*/dhcpd.conf.sample 可以将这个文件覆盖现在的文件
[root@mailsvr1 ~]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
cp:是否覆盖“/etc/dhcpd.conf”? y
/etc/dhcpd.conf文件的简单解释
ddns-update-style interim; #定义所支持的DNS动态更新类型
ignore client-updates; #忽略客户端更新
subnet 192.168.0.0 netmask 255.255.255.0 {
# --- default gateway
option routers 192.168.0.1; #网关地址
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服务器地址
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; #动态IP地址范围
default-lease-time 21600; #默认IP租约时间,单位秒
max-lease-time 43200; #客户端IP租约时间的最大值,单位秒
# 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;
}
}
可以修改为
ddns-update-style interim;
ignore client-updates;
option domain-name "haha.com";
subnet 192.168.2.0 netmask 255.255.255.0 {
option routers 192.168.2.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.2.1;
option domain-name "haha.com";
range dynamic-bootp 192.168.2.20 192.168.2.250;
default-lease-time 21600;
max-lease-time 43200;
}
启动服务;
/etc/init.d/dhcpd start
查看日志/var/log/messages,出现如下,表示服务成功启动。
Dec 23 19:57:33 mailsvr1 dhcpd: Internet Systems Consortium DHCP Server V3.0.5-RedHat
Dec 23 19:57:33 mailsvr1 dhcpd: Copyright 2004-2006 Internet Systems Consortium.
Dec 23 19:57:33 mailsvr1 dhcpd: All rights reserved.
Dec 23 19:57:33 mailsvr1 dhcpd: For info, please visit