1.服務器配置/etc/dhcpd.conf
ddns-update-style interim;
default-lease-time 216000;
max-lease-time 432000;
option domain-name "test.com";
option domain-name-servers 192.168.1.1,202.106.0.20;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.100;
option subnet-mask 255.255.255.0
option routers 192.168.1.1;
host server01 {
hardware ethernet 00:0c:c3:23:dd:3f;
fixed-address 192.168.1.111;
option subnet-mask 255.255.255.0;
option routers 192.168.1.1;
}
}
在/etc/sysconfig/dhcpd文件中指定須要提供dhcpd服務的網絡接口。
DHCPDARGS=eth0
能夠經過查看/var/lib/dhcp/dhcpd.leases文件瞭解DHCP服務器向DHCP客戶機提供租用的每一個IP地址的信
息。
------------------------------------------------------------------------
DHCP服務器配置說明
-----------------------------------------------------------------------
ddns-update-style interim;
#配置使用過渡性 DHCP-DNS互動更新模式。
ignore client-updates;
#忽略客戶端更新
subnet 192.168.0.0 netmask 255.255.255.0 {
#設置子網聲明
option routers 192.168.0.1; #設置缺省網關爲192.168.0.1 option subnet-mask 255.255.255.0; #設置客戶端的子網掩碼 option nis-domain "domain.org"; #爲客戶設置NIS域 option domain-name "domain.org"; #爲客戶設置域名 option domain-name-servers 192.168.1.1; #爲客戶設置域名服務器 option time-offset -18000; # Eastern Standard Time #設置偏移時間。 # option ntp-servers 192.168.1.1; 設置NTP服務器。 # option netbios-name-servers 192.168.1.1; 設置wins服務器 range dynamic-bootp 192.168.0.128 192.168.0.255; #設置動態的地址池。 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; 指定dhcp客戶的mac地址 fixed-address 207.175.42.254; 給指定的mac地址分配ip } }