DHCP分配地址时的顺序问题[1]

[入库:2005年9月19日] [更新:2007年3月24日]

本文简介:


ddns-update-style ad-hoc;
max-lease-time 3600;
default-lease-time 3600;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
option domain-name-servers 192.168.0.1;
option domain-name "home.net.cn";

subnet 192.168.0.0 netmask 255.255.255.0 {
        range 192.168.0.80 192.168.0.100;
}

上面是我的/etc/dhcpd.conf
现在所有被分配的及其,IP地址都是从100倒着分配,100、99、98,这样,不知道为什么

有没有办法分配80、81、82这样

(注释,80这个地址可能被占用,DHCP分配的时候会不会发现80地址存在而从后向前分配?)

 leaper 回复于:2004-07-22 18:09:05
这种现像倒没碰到过

我碰到大都是从中取出一个,并非是从最大的开始。

我想可能跟版本在内核处理上的问题吧。

 llzqq 回复于:2004-07-22 18:34:03
应该是从高到低分配的,我的也一样,好象不能改变。

 yunqing 回复于:2004-07-23 05:26:19
有什么区别吗,如果必要把MAC地址绑定就是了。

 simtiger 回复于:2004-07-24 12:48:02
"...80这个地址可能被占用,DHCP分配的时候会不会发现80地址存在..."

会的。按照DHCP 的RFC建议,C/S都会探测
1)DHCP Server在分配每个地址之前都会探测这个地址的存在(一般用PING),如果存在,就会在地址池中按照策略选择另一个IP。不过在某些DHCP服务器上,这个是可选项,默认是打开的。

2)DHCP Client在使用这个IP之前也会探测这个地址的存在(一般用ARP),如果发现地址已经被使用,就会向服务器报告,服务器会另选一个IP分配,并标记这个问题IP。

 rayz 回复于:2004-07-24 19:15:45
说道DHCP我碰到一个问题特让我郁闷

cisco 3550 switch
因为下面有lan switch所以用linux 作DHCP server,计划慢慢收集mac做绑定。
设置完成后正好是周末,测试通过就回家了
周一一上班,n电话过来说不能上网了, 跑去一看,所有的client都无法获得ip.
而我自己的已经在dhcpd.conf上绑定了,就获得了ip

后来发现所有ip必须绑定否则会提示连接dhcp server timed out
导线在也没高明白,dhcp广播的,干吗非要制定ip才能起作用
不过anyway绑定ip可以用...

 platinum 回复于:2004-07-24 20:26:06
windows的DHCP服务是从小地址开始分配
ADSL猫如果开启了DHCP服务,也是从小地址开始分配
原来用的RH73忘记是如何的了,现在用的是AS3,却是从大地址开始分配

这方面的资料网上也没有找到……

 Linux@初学者 回复于:2004-07-24 20:44:46
我上RHCE时老师说过:LINUX的DHCP分配顺序就是倒着来的!和WNI的相反!

 platinum 回复于:2004-07-24 20:54:38
哈,看来培训过和没参加过培训,就是不一样啊:)

 Linux@初学者 回复于:2004-07-24 20:56:15
不行不行,我很菜,只是会P毛呀!

 leaper 回复于:2004-07-24 20:58:37
看来交钱还是有东西学的

 網中人 回复于:2004-07-24 23:04:06
[quote:14166027d1="simtiger"]"...80这个地址可能被占用,DHCP分配的时候会不会发现80地址存在..."

会的。按照DHCP 的RFC建议,C/S都会探测
1)DHCP Server在分配每个地址之前都会探测这个地址的存在(一般用PING),如果存在,就会在地址池中..........[/quote:14166027d1]

能請問是哪份 RFC 嗎?
我倒是第一次聽到過這個說法...

 LEOD 回复于:2004-07-25 02:33:51
linux是倒着分配的!
但我也不知道为什么这样子!
有谁知道吗!?

 fushuyong 回复于:2004-07-25 07:22:44
呵呵,写程序的时候,策略是倒着分配,它就会倒着分配咯,呵呵。说老实话,我不喜欢DHCP。不是万不得以,偶不爱用它。

 simtiger 回复于:2004-07-25 19:58:42
[quote:5aa9e7cb70="網中人"]

能請問是哪份 RFC 嗎?
我倒是第一次聽到過這個說法...[/quote:5aa9e7cb70]



RFC2131/2132
以前做DHCP SERVER时研究过相关RFC,所以记得比较清楚。

 網中人 回复于:2004-07-25 20:17:03
大哥能貼一下是哪一 section 嗎?

小弟看完兩篇, 找不到你提到的 ping 與 arp ...
在 rfc-2131 之 4.3.1 DHCPDISCOVER message , 只提到如下:
[code:1:bf6d2c63d3]The server must also choose an expiration time for the lease, as follows:; 


IF the client has not requested a specific lease in the DHCPDISCOVER message and the client already has an assigned network address, the server returns the lease expiration time previously assigned to that address (note that the client must explicitly request a specific lease to extend the expiration time on a previously assigned address), ELSE 

IF the client has not requested a specific lease in the DHCPDISCOVER message and the client does not have an assigned network address, the server assigns a locally configured default lease time, ELSE 

IF the client has requested a specific lease in the DHCPDISCOVER message (regardless of whether the client has an assigned network address), the server may choose either to return the requested lease (if the lease is acceptable to local policy) or select another lease. 

...[skiped]

Once the network address and lease have been determined, the server constructs a DHCPOFFER message with the offered configuration parameters. It is important for all DHCP servers to return the same parameters (with the possible exception of a newly allocated network address) to ensure predictable client behavior regardless of which server the client selects. The configuration parameters MUST be selected by applying the following rules in the order given below. The network administrator is responsible for configuring multiple DHCP servers to ensure uniform responses from those servers. The server MUST return to the client:; 


The client's network address, as determined by the rules given earlier in this section, 

The expiration time for the client's lease, as determined by the rules given earlier in this section, 

Parameters requested by the client, according to the following rules:; 

IF the server has been explicitly configured with a default value for the parameter, the server MUST include that value in an appropriate option in the 'option' field, ELSE 

IF the server recognizes the parameter as a parameter defined in the Host Requirements Document, the server MUST include the default value for that parameter as given in the Host Requirements Document in an appropriate option in the 'option' field, ELSE 

The server MUST NOT return a value for that parameter, 
The server MUST supply as many of the requested parameters as possible and MUST omit any parameters it cannot provide. The server MUST include each requested parameter only once unless explicitly allowed in the DHCP Options and BOOTP Vendor Extensions document. 


Any parameters from the existing binding that differ from the Host Requirements Document defaults, 

Any parameters specific to this client (as identified by the contents of 'chaddr' or 'client identifier' in the DHCPDISCOVER or DHCPREQUEST message), e.g., as configured by the network administrator, 

Any parameters specific to this client's class (as identified by the contents of the 'vendor class identifier' option in the DHCPDISCOVER or DHCPREQUEST message), e.g., as configured by the network administrator; the parameters MUST be identified by an exact match between the client's vendor class identifiers and the client's classes identified in the server, 

Parameters with non-default values on the client's subnet. [/code:1:bf6d2c63d3]

同樣的, 在 4.4.1 Initialization and allocation of network address 一節也沒提到...

 simtiger 回复于:2004-07-25 22:24:05
现在手中没有RFC文档

本文关键:DHCP分配地址时的顺序问题
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top