首先要查看是否安装了DHCP的RPM
#rpm -qa | grep dhcp
如果没有安装进入RHEL5的安装光盘中的Server文件夹内
#rpm -ivh dhcp-3
安装成功后,进入/usr/share/doc/dhcp-3/文件夹内
拷贝示例文档到/etc/dhcpd.conf
#cp dhcpd.conf.sample /etc/dhcpd.conf
我们在使用vi编辑我们的dhcpd.conf配置文件:
#vi /etc/dhcpd.conf
===============dhcpd.conf===============
ddns-update-style interim;
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";
option domain-name-servers 202.106.0.20; <---------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;
default-lease-time 21600; <---------默认租约时间是6小时
max-lease-time 43200; <---------最大租约时间是12小时
# we want the nameserver to appear at a fixed address
host ns { <-------主机名称是"ns"
next-server marvin.redhat.com;
hardware ethernet 12:34:56:78:AB:CD; <------按照MAC地址分配IP地址
fixed-address 207.175.42.254; <------分配的IP地址
}
}
编辑好以后退出。
开启DHCP服务,如果做实验记得把路由的DHCP服务关闭
#service dhcpd start
开机默认开启
#chkconfig dhcpd on
阅读(1580) | 评论(0) | 转发(0) |