isc dhcpd 3.0 快速安装实例[笔记更新]

发表于:2007-06-09来源:作者:点击数: 标签:
[code:1:0824bcdf3c]#############isc-dhcpd3.0########## iscdhcpd3.0快速安装实例 阿土AborigenYin 2003.06.19 目的: 为内网提供dhcp服务,每个网卡一个网段; 平台: FreeBSD5.1+ports #程序安装 cd/data/usr/ports/net/isc-dhcp3 makecleaninstallclean

[code:1:0824bcdf3c]############# isc-dhcpd 3.0 ##########
isc dhcpd 3.0 快速安装实例

阿土 Aborigen Yin
2003.06.19

目的:
为内网提供dhcp服务,每个网卡一个网段;
平台:
FreeBSD 5.1 + ports

#程序安装
cd /data/usr/ports/net/isc-dhcp3
make clean install clean

###配置
#/usr/local/etc/dhcpd.conf.sample 是个很好的参考文件;

########### 
#注意:一下配置的多个网段,分别对应服务器上多个网卡的地址段,而不是单一网卡上的多个地址(address alias 地址别名);
#如果你有某网卡设置多个地址,而配置文件中分别给这些网段设置了subnet(这是很多人所谓的”多网段dhcp地址分配“),那么启动
#dhcpd时,会收到如下错误,一般是发送到/var/log/messages:
#Jun 19 14:49:14 mail dhcpd: Interface fxp1 matches multiple shared networks
#
##############

#vi /usr/local/etc/dhcpd.conf
#begin of dhcpd.conf
# dhcpd.conf
server-identifier mail.oss4e.org;
option domain-name "oss4e.org";
option domain-name-servers 202.96.134.133;

default-lease-time 600;
max-lease-time 7200;

#重要,没有这一行不能启动dhcpd。
ddns-update-style none;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;

# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;

# Hosts which require special configuration options can be listed in
# host statements.   If no address is specified, the address will be
# allocated dynamically (if possible), but the host-specific information
# will still come from the host declaration.

# Fixed IP addresses can also be specified for hosts.   These addresses
# should not also be listed as being available for dynamic assignment.
# Hosts for which fixed IP addresses have been specified can boot using
# BOOTP or DHCP.   Hosts for which no fixed address is specified can only
# be booted with DHCP, unless there is an address range on the subnet
# to which a BOOTP client is connected which has the dynamic-bootp flag
# set.
#host fantasia {
#  hardware ethernet 08:00:07:26:c0:a5;
#  fixed-address fantasia.fugue.com;
#}
#group优先于subnet。
group {
                # PXE-specific configuration directives...

                #next-server 172.16.100.249;
                #filename "/pxelinux.0";

                # You need an entry like this for every host
                # unless you're using dynamic addresses

                host temp {
                        hardware ethernet 00:08:c7:08:68:2b;
                        #172.16.100.189 - 172.16.100.199
                        fixed-address 172.16.100.189;
                        option host-name "temp.oss4e.org";
                        next-server 172.16.230.254;
         filename "/pxelinux.0";
               }
}

#可以为不同的网段分配ip;

#subnet 172.16.100.0 netmask 255.255.255.0 {
#       server-identifier 172.16.100.245;
#       range dynamic-bootp 172.16.100.139 172.16.100.187;
#       option domain-name-servers 172.16.100.254;
#       option domain-name "oss4e.org";
#       option routers 172.16.100.254;
#       option broadcast-address 172.16.100.255;
#       default-lease-time 6000;
#       max-lease-time 72000;

#       allow booting;
#       allow bootp;

#       next-server 172.16.100.245;
#       filename "/pxelinux.0";
#}

subnet 172.16.250.0 netmask 255.255.255.0 {
        server-identifier 172.16.250.254;
        range dynamic-bootp 172.16.250.139 172.16.250.187;
        option domain-name-servers 172.16.250.254;
        option domain-name "oss4e.org";
        option routers 172.16.250.254;
        option broadcast-address 172.16.250.255;
        default-lease-time 6000;
        max-lease-time 72000;

        allow booting;
        allow bootp;

        next-server 172.16.250.254;
        filename "/pxelinux.0";
}

###
subnet 172.16.230.0 netmask 255.255.255.0 {
        server-identifier 172.16.230.254;
        range dynamic-bootp 172.16.230.139 172.16.230.187;
        option domain-name-servers 172.16.230.254;
        option domain-name "oss4e.org";
        option routers 172.16.230.254;
        option broadcast-address 172.16.230.255;
        default-lease-time 6000;
        max-lease-time 72000;

        allow booting;
        allow bootp;

        next-server 172.16.230.254;
        filename "/pxelinux.0";
}

#subnet 192.168.0.0 netmask 255.255.255.0 {
#        server-identifier 192.168.0.254;
#        range dynamic-bootp 192.168.0.139 192.168.0.187;
#        option domain-name-servers 192.168.0.254;
#        option domain-name "websofts.com";
#        option routers 192.168.0.254;
#        option broadcast-address 192.168.0.255;
#        default-lease-time 6000;
#        max-lease-time 72000;
 
#        #allow booting;
#        #allow bootp;
 
#        #next-server 192.168.0.254;
#        #filename "/pxelinux.0";
#}

#end of dhcpd.conf

cp -p /usr/local/etc/rc.d/isc-dhcpd.sh.sample /usr/local/etc/rc.d/isc-dhcpd.sh
###end[/code:1:0824bcdf3c]

由于论坛吃空格的问题,如需参考本配置文件,请按照dhcpd.conf的格式自行缩进排版。

 红袖添香 回复于:2003-06-19 20:53:50
...

> #重要,没有这一行不能启动dhcpd。
> ddns-update-style none; 

:?:  肯定吗?这一句好象只是不启用自动更新...


我的 conf  没有这一句,但是运行良好。


# dhcpd.conf
#
#
# Global settings
#
default-lease-time 86400;
max-lease-time 86400;
option subnet-mask 255.255.255.0;
option broadcast-address 10.0.0.255;
option routers 10.0.0.2;
option domain-name-servers 10.0.0.2, 212.185.249.116;
option domain-name "moon.home";

subnet 10.0.0.0 netmask 255.255.255.0 {
      range 10.0.0.230 10.0.0.250;
}

subnet 10.0.1.0 netmask 255.255.255.0 {
      # max-lease-time 28800;
      range 10.0.1.230 10.0.1.250;
      # deny unknown clients;
}

subnet ... 

subnet ... 

host magic {
      hardware ethernet XX:XX:XX:XX:XX:XX;
      fixed-address 10.0.0.101;
}

host iris {
      hardware ethernet XX:XX:XX:XX:XX:XX;
      fixed-address 10.0.0.102;
}

host ...

# --- End of file: dhcpd.conf

 jamwolf 回复于:2003-06-19 21:03:08
我的配置和红袖一样,但是就是不能启动,唉!

 红袖添香 回复于:2003-06-19 21:34:22
[quote:b762f78eaa="jamwolf"]我的配置和红袖一样,但是就是不能启动,唉![/quote:b762f78eaa]    

dhcp -d 

帖出详细错误信息

 jamwolf 回复于:2003-06-19 22:26:12
刚刚做了一个试验,dhcpd.conf内容没变,加上了一句ddns-update-style none;就能启动了,自动向客户端分配IP也正常了。

P.S. ISC-DHCPD分配IP的顺序还挺逗,range 192.168.141.100 192.168.141.200;结果先分出去的是200,然后依次是199、198、197...

 aborigen 回复于:2003-06-19 22:32:10
[quote:f3b8490096="红袖添香"]...

> #重要,没有这一行不能启动dhcpd。
> ddns-update-style none; 

:?:  肯定吗?这一句好象只是不启用自动更新...


我的 conf  没有这一句,但是运行良好。


# dhcpd.conf
#
#
# Global..........[/quote:f3b8490096]     


isc-dhcpd 2.x 没问题,isc-dhcpd 3.x 不行的。

## with ddns- ###It is ok.##

[code:1:f3b8490096]Jun 19 22:29:07 mail dhcpd: Internet Software Consortium DHCP Server V3.0.1rc11
Jun 19 22:29:07 mail dhcpd: Copyright 1995-2003 Internet Software Consortium.
Jun 19 22:29:07 mail dhcpd: All rights reserved.
Jun 19 22:29:07 mail dhcpd: For info, please visit http://www.isc.org/products/DHCP
Jun 19 22:29:07 mail dhcpd: Internet Software Consortium DHCP Server V3.0.1rc11
Jun 19 22:29:07 mail dhcpd: Copyright 1995-2003 Internet Software Consortium.
Jun 19 22:29:07 mail dhcpd: All rights reserved.
Jun 19 22:29:07 mail dhcpd: For info, please visit http://www.isc.org/products/DHCP
Jun 19 22:29:07 mail dhcpd: Wrote 0 deleted host decls to leases file.
Jun 19 22:29:07 mail dhcpd: Wrote 0 new dynamic host decls to leases file.
Jun 19 22:29:07 mail dhcpd: Wrote 1 leases to leases file.
Jun 19 22:29:07 mail dhcpd: Listening on BPF/fxp2/00:30:48:22:8d:27/172.16.230.0/24
Jun 19 22:29:07 mail dhcpd: Sending on   BPF/fxp2/00:30:48:22:8d:27/172.16.230.0/24
Jun 19 22:29:07 mail dhcpd: Listening on BPF/fxp1/00:30:48:22:8d:26/172.16.250.0/24
Jun 19 22:29:07 mail dhcpd: Sending on   BPF/fxp1/00:30:48:22:8d:26/172.16.250.0/24
Jun 19 22:29:07 mail dhcpd: 
Jun 19 22:29:07 mail dhcpd: No subnet declaration for fxp0 (172.16.100.243).
Jun 19 22:29:07 mail dhcpd: ** Ignoring requests on fxp0.  If this is not what
Jun 19 22:29:07 mail dhcpd:    you want, please write a subnet declaration
Jun 19 22:29:07 mail dhcpd:    in your dhcpd.conf file for the network segment
Jun 19 22:29:07 mail dhcpd:    to which interface fxp0 is attached. **
Jun 19 22:29:07 mail dhcpd: 
Jun 19 22:29:07 mail dhcpd: Sending on   Socket/fallback/fallback-net[/code:1:f3b8490096]


### without #########
[code:1:f3b8490096]
Jun 19 22:30:37 mail dhcpd: Internet Software Consortium DHCP Server V3.0.1rc11
Jun 19 22:30:37 mail dhcpd: Copyright 1995-2003 Internet Software Consortium.
Jun 19 22:30:37 mail dhcpd: All rights reserved.
Jun 19 22:30:37 mail dhcpd: For info, please visit http://www.isc.org/products/DHCP
Jun 19 22:30:37 mail dhcpd: 
Jun 19 22:30:37 mail dhcpd: ** You must add a ddns-update-style statement to /usr/local/etc/dhcpd.conf.
Jun 19 22:30:37 mail dhcpd:    To get the same behaviour as in 3.0b2pl11 and previous
Jun 19 22:30:37 mail dhcpd:    versions, add a line that says "ddns-update-style ad-hoc;"
Jun 19 22:30:37 mail dhcpd:    Please read the dhcpd.conf manual page for more information. **
Jun 19 22:30:37 mail dhcpd: 
Jun 19 22:30:37 mail dhcpd: If you did not get this software from ftp.isc.org, please
Jun 19 22:30:37 mail dhcpd: get the latest from ftp.isc.org and install that before
Jun 19 22:30:37 mail dhcpd: requesting help.
Jun 19 22:30:37 mail dhcpd: 
Jun 19 22:30:37 mail dhcpd: If you did get this software from ftp.isc.org and have not
Jun 19 22:30:37 mail dhcpd: yet read the README, please read it before requesting help.
Jun 19 22:30:37 mail dhcpd: If you intend to request help from the dhcp-server@isc.org
Jun 19 22:30:37 mail dhcpd: mailing list, please read the section on the README about
Jun 19 22:30:37 mail dhcpd: submitting bug reports and requests for help.
Jun 19 22:30:37 mail dhcpd: 
Jun 19 22:30:37 mail dhcpd: Please do not under any circumstances send requests for
Jun 19 22:30:37 mail dhcpd: help directly to the authors of this software - please
Jun 19 22:30:37 mail dhcpd: send them to the appropriate mailing list as described in
Jun 19 22:30:37 mail dhcpd: the README file.
Jun 19 22:30:37 mail dhcpd: 
Jun 19 22:30:37 mail dhcpd: exiting.
###
[/code:1:f3b8490096]

It say "** You [size=18:f3b8490096][color=red:f3b8490096]must [/color:f3b8490096][/size:f3b8490096]add a ddns-update-style statement to /usr/local/etc/dhcpd.conf.
   To get the same behaviour as in 3.0b2pl11 and previous
   versions, add a line that says "ddns-update-style ad-hoc;"
   Please read the dhcpd.conf manual page for more information. **"

 :P  :P

 aborigen 回复于:2003-06-19 22:34:31
[quote:d73f1962be="jamwolf"]刚刚做了一个试验,dhcpd.conf内容没变,加上了一句ddns-update-style none;就能启动了,自动向客户端分配IP也正常了。

P.S. ISC-DHCPD分配IP的顺序还挺逗,range 192.168.141.100 192.168.141.200;结果先分出去..........[/quote:d73f1962be]     


恭喜你 :lol: 

PS:你讨论问题不怎么有贴日志的习惯,这个很不利于讨论。

 红袖添香 回复于:2003-06-20 00:30:10
[quote:fd53d5c79b="aborigen"]sc-dhcpd 2.x 没问题,isc-dhcpd 3.x 不行的。

## with ddns- ###It is ok.## [/quote:fd53d5c79b] 

确实,原来偶的版本还只有2.x啊,不说还不知道。。。 :roll: 

sleeve@magic:~$ [b:fd53d5c79b]dhcpd[/b:fd53d5c79b]
Internet Software Consortium DHCP Server [color=red:fd53d5c79b]2.0pl5[/color:fd53d5c79b]-OpenBSD
Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.
All rights reserved.

Please contribute if you find this software useful.
For info, please visit http://www.isc.org/dhcp-contrib.html

...
sleeve@magic:~$

 kinux 回复于:2003-06-20 00:34:34
[quote:5e8c48ea94="红袖添香"]OpenBSD
Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.
All rights reserved.

Please contribute if you find this software useful.
For info, please visit http://www.isc.or..........[/quote:5e8c48ea94]     

奇怪, 你屋企叫用dhcp??? :roll:

 红袖添香 回复于:2003-06-20 00:43:46
[quote:deac29cf27="kinux"]    

奇怪, 你屋企叫用dhcp??? :roll:[/quote:deac29cf27]    

屋企?  :?: 

什么意思?   :roll:

 kinux 回复于:2003-06-20 00:51:49
[quote:6f3cb76d54="红袖添香"]   

屋企?  :?: 

什么意思?   :roll:[/quote:6f3cb76d54]     

家里

 红袖添香 回复于:2003-06-20 01:08:27
[quote:5201927ee6="kinux"]    

家里[/quote:5201927ee6]    

家里就不能用啦? :?

学习学习咯    :!:

 dylix 回复于:2003-06-20 01:13:35
我也在家里用的

 kinux 回复于:2003-06-20 01:16:48
[quote:9cedd17dda="红袖添香"]   

家里就不能用啦? :?

学习学习咯    :!:[/quote:9cedd17dda]     

在家里学习...

也许我要试试... 8)

 红袖添香 回复于:2003-06-20 01:32:41
[quote:839ce55163="kinux"]    

在家里学习...

也许我要试试... 8)[/quote:839ce55163]    

呵呵,不在家中,我还根本没有BSD环境!
学校有AIX,HP-UX,Solaris,Linux... 唯读没有BSD! :roll:

 kinux 回复于:2003-06-20 01:38:35
[quote:8ee30e3483="红袖添香"]   

呵呵,不在家中,我还根本没有BSD环境!
学校有AIX,HP-UX,Solaris,Linux... 唯读没有BSD! :roll:[/quote:8ee30e3483]    

haha!!!

那你把他们看部都学了.. :lol:     

你的学校太有錢了, 什么都有, 就是沒有BSD...
好像有点讨貴不讨好的样子, 不过大部分的学校都是这样..
BSD就好像是个孤儿, 苦苦掙扎...
当然也有例外..
[img:8ee30e3483]http://acme.ecn.purdue.edu/pics/2000.07.01/cluster_front_5.jpg[/img:8ee30e3483]
http://acme.ecn.purdue.edu/

 红袖添香 回复于:2003-06-20 01:48:29
[quote:bdefb107ba="kinux"]   

haha!!!

那你把他们看部都学了.. :lol:[/quote:bdefb107ba]    

嗨,一个 user aclearcase/" target="_blank" >ccount 有什么用?
除了能 ls -l 和 mutt 还能玩出什么花样?! :?:  :?  :roll:

 kinux 回复于:2003-06-20 02:16:44
那倒也是....
在学校里是只能用不能玩..

 vadem 回复于:2003-06-20 03:35:05
我早就安装过的,但是不知道为何IP地址是倒序分配的,如:10-254,客户机会首先取254
而且默认的lease时间太短

 红袖添香 回复于:2003-06-20 04:30:03
...

在旧的版本,比如我的 2.x ,IP 的分配是按升序排列的。

但是从 3.x 开始,IP 的分配不再是按照升序分配,
因为空闲 IP 是以哈希表的形式存放的,
这就决定不可能是个某个特定的升序或降序,
当你得到一个 IP 后,你无法预测下一个会是多少。

 jiangrui80 回复于:2004-10-18 21:09:14
你好:如何在LINUX下实现
--------------------------------------------------------------------------------

比如如何把192.168.28.0这个网段分成以下两段: 
192.168.28.1 192.168.28.190 
192.168.28.191 192.168.28.254

 llzqq 回复于:2004-10-19 11:54:56
给楼主补充一点:

在一个指定的网卡上提供服务:

# vi /usr/local/etc/rc.d/isc-dhcpd.sh

dhcpd_ifaces=rl0 # ethernet interface(s)

 shao1jie1 回复于:2004-12-29 13:08:10
为什么会出现多台终端拿不到IP,
我设置了三个网段
10.0.1.0 10.0.2.0 10.0.3.0

 Macolex 回复于:2004-12-30 14:56:15
[quote:d5c58e1ea9="红袖添香"]   

呵呵,不在家中,我还根本没有BSD环境!
学校有AIX,HP-UX,Solaris,Linux... 唯读没有BSD! :roll:[/quote:d5c58e1ea9]

那她上BSD都是远程登录?

原文转自:http://www.ltesting.net