DHCP
服务器配置:
找到
dhcp-3.0.5-7.el5.i386.rpm
这个包,然后安装。
安装
rpm -ivh foo-1.0-l.i386.rpm i
表示
includedocs
安装文档,
V
表示显示附加信息,
h
表示
hash
安装时输出
hash
记号。
[root@test Server]# rpm -ivh dhcp-3.0.5-21.el5.i386.rpm
warning: dhcp-3.0.5-21.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:dhcp ########################################### [100%]
表示安装成功。
安装成功后会生成以下两个文件
配置文件是
/etc/dhcpd.conf ,
租约数据库文件时
/var/lib/dhcpd/dhcpd.leases ,
然后,编辑
/etc/dhcpd.conf ,
[root@test dhcpd]# vi /etc/dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
其中会显示这两行
接下来,我们要将
/usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample
覆盖到
/etc/dhcp.conf
[root@test dhcp-3.0.5]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
cp
:是否覆盖“
/etc/dhcpd.conf
”
? y
然后编辑
/etc/dhcpd.conf
文件:
[root@test etc]# vi 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; #
定义所支持的
DNS
动态更新类型
ignore client-updates; #
忽略客户端更新
subnet 192.168.100.0 netmask 255.255.255.0 {
# --- default gateway
option routers 192.168.100.1; #
网关地址
option subnet-mask 255.255.255.0; #
子网掩码:默认子网掩码
option nis-domain "yanglei.com";
option domain-name "yanglei.com"; #DNS
后缀
option domain-name-servers 192.168.100.1; #DNS
服务器地址
option time-offset -18000; # Eastern Standard Time
# option ntp-servers 192.168.100.1;
# option netbios-name-servers 192.168.100.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.100.10 192.168.100.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;
}
}
修改完后保存。
启动服务
:
[root@test etc]# /etc/init.d/dhcpd start
启动
dhcpd
:
[
确定
]
启动完成后,查看日志:
[root@test etc]# tail -f /var/log/messages
Oct 27 15:07:17 test dhcpd: Copyright 2004-2006 Internet Systems Consortium.
Oct 27 15:07:17 test dhcpd: All rights reserved.
Oct 27 15:07:17 test dhcpd: For info, please visit http://www.isc.org/sw/dhcp/
Oct 27 15:07:17 test dhcpd: WARNING: Host declarations are global. They are not limited to the scope you declared them in.
Oct 27 15:07:17 test dhcpd: Wrote 0 deleted host decls to leases file.
Oct 27 15:07:17 test dhcpd: Wrote 0 new dynamic host decls to leases file.
Oct 27 15:07:17 test dhcpd: Wrote 0 leases to leases file.
Oct 27 15:07:17 test dhcpd: Listening on LPF/eth0/00:0c:29:fa:b0:cd/192.168.100/24
Oct 27 15:07:17 test dhcpd: Sending on LPF/eth0/00:0c:29:fa:b0:cd/192.168.100/24
Oct 27 15:07:17 test dhcpd: Sending on Socket/fallback/fallback-net
日志显示如上
说明配置完成。
网络设置为自动获取,检查网路中地址如果在
192.168.100.10 192.168.100.254;
这个段内,说明配置成功。