CentOS 5.5 DHCP服务器安装指南:
1.直接用yum -y dhcp安装好dhcp rpm软件包。也可以到http://pbone.net上下载即可。
2.安装好之后就是拷贝配置文件dhcpd.conf文件,在/usr/share/doc/dhcp-3.0/dhcpd.conf.example 把这个样本文件拷重新命名拷贝到 /etc/dhcpd.conf即可
3.vi /etc/dhcpd.conf 内容如下这个是我已经修改好的,只要修改这个文件即可。
ddns-update-style interim;
ignore client-updates;
subnet 192.168.10.0 netmask 255.255.255.0 { //subnet一个子网中的客户端,动态地指定ip地址,则在此subnet声明中,必须包含一组ip地址范围。
# --- default gateway
option routers 192.168.10.15; //网关地址
option subnet-mask 255.255.255.0;//子网掩码
option nis-domain "my.lk.org";
option domain-name "my.lk.org";
option domain-name-servers 202.101.172.35; //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.10.128 192.168.10.254; //地址池pool范围地址
default-lease-time 21600;//默认的ip租用时间期限单位为秒
max-lease-time 43200;//ip租用最长的期限单位为秒
# we want the nameserver to appear at a fixed address //用来绑定服务器的mac物理地址。
host ns {
next-server stationx.example.com;
hardware ethernet 00:0C:29:7E:7F:86;
fixed-address 192.168.10.223;
}
}
4.service dhcpd start 即可启动,如果想开机启动可以ntsysv 服务当中选择dhcpd星号即可。
配置文件也可以写成以下形式:
#//192.168.10.*
subnet 192.168.10.0 netmask 255.255.255.0 {
option routers 192.168.10.15; 网关
option subnet-mask 255.255.255.0; //子网掩码
option broadcast-address 192.168.10.255; //广播地址
option domain-name-servers
202.101.172.xx,202.101.172.4.xx
range dynamic-bootp 192.168.10.20 192.168.10.150; //地址池范围
default-lease-time 21600;
max-lease-time 43200;
}