一,首先是安装DHCP的rpm包 ,然后配置下列文档,如在10.255.6.0子网掩码是255.255.255.0 的
DHCP的配置文档/etc/dhcpd.conf
====================================================
ddns-update-style interim;
ignore client-updates;
subnet 10.255.6.0 netmask 255.255.255.0 {
# --- default gateway
option routers 10.255.0.1;
option subnet-mask 255.255.0.0;
option nis-domain "domain.org";
option domain-name "domain.org";
option domain-name-servers 192.168.1.1;
option time-offset -18000; # Eastern Standard Time
# option ntp-servers 10.255.0.1;
# option netbios-name-servers 10.255.0.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 10.255.6.0 10.255.6.250;
default-lease-time 21600;
max-lease-time 43200;
# 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;
}
}
=========================================================
以下是分配IP地址的数据库文件 /var/lib/dhcp/dhcpd.leases
=========================================================
# All times in this file are in UTC (GMT), not your local timezone. This is
# not a bug, so please don't ask about it. There is no portable way to
# store leases in the local timezone, so please don't request this as a
# feature. If this is inconvenient or confusing to you, we sincerely
# apologize. Seriously, though - don't ask.
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-V3.0pl1
lease 10.255.6.163 {
starts 0 2008/06/22 09:52:01;
ends 0 2008/06/22 15:52:01;
binding state active;
next binding state free;
hardware ethernet 00:e0:4d:55:db:68;
uid "/001/000/340MU/333h";
client-hostname "C50039780A554CA";
}
lease 10.255.6.163 {
starts 0 2008/06/22 09:53:01;
ends 0 2008/06/22 15:53:01;
binding state active;
next binding state free;
hardware ethernet 00:e0:4d:55:db:68;
uid "/001/000/340MU/333h";
client-hostname "C50039780A554CA";
}
lease 10.255.6.163 {
starts 0 2008/06/22 09:53:01;
ends 0 2008/06/22 09:53:13;
tstp 0 2008/06/22 09:53:13;
binding state free;
hardware ethernet 00:e0:4d:55:db:68;
uid "/001/000/340MU/333h";
client-hostname "C50039780A554CA";
}
lease 10.255.6.163 {
starts 0 2008/06/22 09:53:25;
ends 0 2008/06/22 15:53:25;
binding state active;
next binding state free;
hardware ethernet 00:e0:4d:55:db:68;
uid "/001/000/340MU/333h";
client-hostname "C50039780A554CA";
}
lease 10.255.6.153 {
starts 0 2008/06/22 09:58:29;
ends 0 2008/06/22 15:58:29;
binding state active;
next binding state free;
hardware ethernet 00:18:37:06:a2:cf;
uid "/001/000/0307/006/242/317";
client-hostname "MICROSOF-D7C616";
}
lease 10.255.6.153 {
starts 0 2008/06/22 09:58:55;
ends 0 2008/06/22 15:58:55;
binding state active;
next binding state free;
hardware ethernet 00:18:37:06:a2:cf;
uid "/001/000/0307/006/242/317";
client-hostname "MICROSOF-D7C616";
}
lease 10.255.6.153 {
starts 0 2008/06/22 09:58:55;
ends 0 2008/06/22 09:59:03;
tstp 0 2008/06/22 09:59:03;
binding state free;
hardware ethernet 00:18:37:06:a2:cf;
uid "/001/000/0307/006/242/317";
client-hostname "MICROSOF-D7C616";
}
lease 10.255.6.153 {
starts 0 2008/06/22 10:00:29;
ends 0 2008/06/22 16:00:29;
binding state active;
next binding state free;
hardware ethernet 00:18:37:06:a2:cf;
uid "/001/000/0307/006/242/317";
client-hostname "MICROSOF-D7C616";
}
============================================
到此dhcp算是配置成功