免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: platinum
打印 上一主题 下一主题

同一个网段同时有两个DHCP服务器,会怎么样?(已有答案) [复制链接]

论坛徽章:
0
41 [报告]
发表于 2005-12-07 15:27 |只看该作者
原帖由 zjp0902 于 2005-12-1 11:09 发表
应该不会冲突的,DHCP收到客户端的请求后也是用广播把IP发出去,两个DHCP SERVER都是,而客户端先收到哪个SERVER的广播就用那个IP,然后还会发一个确认信息,告诉其他的SERVER他已经收到IP,其他的DHCP SERVER就回停止I ...

再看看 DHCP 的工作原理的资料吧,你说的不对

论坛徽章:
0
42 [报告]
发表于 2005-12-07 15:28 |只看该作者
原帖由 ssffzz1 于 2005-12-6 14:58 发表
应该是没有问题的,因为客户在收到一个IP地址后,还要确认网络中有没有重复的IP,如果有那么会出现新的一轮IP地址分配过程,因此不会有任何冲突

这个是谁负责的?从哪看到的?可否有资料贴一下?

论坛徽章:
0
43 [报告]
发表于 2005-12-08 15:51 |只看该作者
那个SERVER快 就会 分配IP的

论坛徽章:
0
44 [报告]
发表于 2005-12-09 01:56 |只看该作者
原帖由 platinum 于 2005-12-7 15:28 发表

这个是谁负责的?从哪看到的?可否有资料贴一下?

我看了rfc3074,由于涉及到太多算法和数据位的东西,我没有看仔细,按照我的粗劣理解,多个server都收到request,然后一起响应.在优化的情况下,dhcp server会计算哪个server响应,在某个时期可能是一个server响应多些,但从长期趋势来看是平均的,做到了load balance的效果

Because DHCP clients use UDP broadcasts to contact DHCP servers, a
   client DHCPDISCOVER message may be received by more than one server.
   All servers receiving such a broadcast may respond to the client,
   letting the client choose which server it will use.

   When a BOOTP relay agent is used, it typically forwards or
   rebroadcasts client broadcasts to all configured servers, so a
   similar inefficiency is present.

   The optimization described allows a server to be chosen for each such
   transaction by performing a "serve" / "do not serve" computation.  A
   forwarding agent can perform the same computation to choose a
   forwarding destination.

   In either case, the choice of server can be computed, without the
   participants having to negotiate who is to respond.

   The approach is probabilistic in nature, because it is nearly
   impossible to foresee which client will request service next.  For
   short periods of time, the actual percentage of clients served by a
   given server will likely deviate from the desired percentage.  As the
   number of requests grows, the actual percentage of the load being
   handled by each server will approximate the configured percentage.

参考:http://www.ietf.org/rfc/rfc3074.txt

根据IETF上DHC working group发布的网页,rfc3074没有被obsolete掉,也就是还在用的,所以这个load balance的算法应该在广泛使用
参考http://www.ietf.org/html.charters/dhc-charter.html

根据我以前的工作经验,在使用dhcp relay的情况下(用foundry BigIron 8000中的relay), 多个aix上dhcpcd(不同的server)都收到request,虽然我没有抓包,但看到是只有一台的server会产生log,也就是只有一台dhcp server响应.也就是使用了load balance算法优化过了

我想linux下的isc dhcpd程序也应该是遵守rfc3074规范的

[ 本帖最后由 bingosek 于 2005-12-9 13:49 编辑 ]

论坛徽章:
0
45 [报告]
发表于 2005-12-09 02:03 |只看该作者
还有,以下是没有优化的情况,多个server响应,client选择,由rfc2131给出:

The client receives one or more DHCPOFFER messages from one or more
     servers.  The client may choose to wait for multiple responses.
     The client chooses one server from which to request configuration
     parameters, based on the configuration parameters offered in the
     DHCPOFFER messages.  The client broadcasts a DHCPREQUEST message
     that MUST include the 'server identifier' option to indicate which
     server it has selected, and that MAY include other options
     specifying desired configuration values.  The 'requested IP
     address' option MUST be set to the value of 'yiaddr' in the
     DHCPOFFER message from the server.  This DHCPREQUEST message is
     broadcast and relayed through DHCP/BOOTP relay agents.  To help
     ensure that any BOOTP relay agents forward the DHCPREQUEST message
     to the same set of DHCP servers that received the original
     DHCPDISCOVER message, the DHCPREQUEST message MUST use the same
     value in the DHCP message header's 'secs' field and be sent to the
     same IP broadcast address as the original DHCPDISCOVER message.
     The client times out and retransmits the DHCPDISCOVER message if
     the client receives no DHCPOFFER messages.

参考:http://www.ietf.org/rfc/rfc2131.txt

论坛徽章:
0
46 [报告]
发表于 2005-12-09 20:07 |只看该作者
不会有冲突的!就算是2个不同网段的ip也是没有问题的,只要有路由

论坛徽章:
33
荣誉会员
日期:2011-11-23 16:44:17天秤座
日期:2014-08-26 16:18:20天秤座
日期:2014-08-29 10:12:18丑牛
日期:2014-08-29 16:06:45丑牛
日期:2014-09-03 10:28:58射手座
日期:2014-09-03 16:01:17寅虎
日期:2014-09-11 14:24:21天蝎座
日期:2014-09-17 08:33:55IT运维版块每日发帖之星
日期:2016-04-17 06:23:27操作系统版块每日发帖之星
日期:2016-04-18 06:20:00IT运维版块每日发帖之星
日期:2016-04-24 06:20:0015-16赛季CBA联赛之天津
日期:2016-05-06 12:46:59
47 [报告]
发表于 2005-12-09 23:33 |只看该作者
原帖由 sulin515 于 2005-12-6 12:10 发表
没的事的,我的网吧就是两个DHCP.一个WIN2000 一个LINUX,都能正常工作,客户机也没的问题.


不知道你那有多少台机器, dhcp 有几个网段.

按我见过的. win 的 dhcp server 一般会先分配IP 给 client , 其次的是 Linux 的, 然后才是 router 的 dhcp agent.  

为什么会这样我不知道, 但会有这样的结果.

至于在一个网段里同时用两台 dhcp server 的情况,我在生产环境中没见过. 可能我们那的网络的级别不够吧.

但我个人认为, 一般的 IP 分配都在 8 小时以上, 而一台 dhcp server down 8 小时的可能性应该是0的. 还有一个问题, 如果到了8小时, 而client 找不到server, 这个IP也不一定会release 吧? 我倒没试过.

更没试过两台server 分同一个IP给两台机器会不会出现查一下有没有IP的情况. 不过,我知道如果你分了一个IP(静态)给别人, 那就有可能出现DHCP也把这个分给别人, 然后冲突的情况.

所以, 一般我们的做法是, 先用 dhcp 得一个IP, 然后再把这个IP设成固定的.

论坛徽章:
0
48 [报告]
发表于 2005-12-10 19:23 |只看该作者
应该是先接受服务器比较快的那个把!

论坛徽章:
0
49 [报告]
发表于 2005-12-11 01:57 |只看该作者
看来鄙人的网络通信基础课是没有白学的
那个老教授同志也是没有白教的
难得啊。。。。

论坛徽章:
0
50 [报告]
发表于 2005-12-11 11:07 |只看该作者
哈,刚看到,好久以前的贴子又被翻出来了 ^_^
鸟哥说的对,但这样讲很容易让人误解,到底是谁先收到谁的?(字面上更容易理解为哪个服务器先收到,其实不然)

其实原理是:
1、client 先向网络中发 dhcpdiscover
2、所有 dhcp 服务器收到消息以后都要返回 dhcpoffer
3、client 收到 dhcpoffer 有先后,然后再向网络中发送 dhcprequest 广播,来通知各个 dhcp 已经选用了哪个

所以,是看 client 先收到哪个 dhcp server 的 dhcpoffer,而不是看哪个 dhcp server 先收到 client 的请求


鸟哥的电子文档,请哪位给个地址,拜托!!!

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP