关于DHCP服务器的offer与ack阶段是单播还是广播的研究

来源:互联网 发布:2017年淘宝活动有哪些 编辑:程序博客网 时间:2024/05/19 20:46

  最近在研究DHCP服务器的offer与ack阶段是单播还是广播,上课的时候老师说DHCP分配的四个过程都是使用广播的方式,但是我在我的机子里用wireshark截包分析发现跟老师说的不一样,于是就开始了探寻之跟,挣扎了好几天,终于在rfc2131里找到了答案,呵呵,看来要找到真相,还是要从英文文档那里着手,原文如下(请注意红色字体):

 

  A client that cannot receive unicast IP datagrams until its protocol software has been configured with an IP address SHOULD set the BROADCAST bit in the 'flags' field to 1 in any DHCPDISCOVER or DHCPREQUEST messages that client sends. The BROADCAST bit will provide a hint to the DHCP server and BOOTP relay agent to broadcast any messages to the client on the client's subnet. A client that can receive unicast IP datagrams before its protocol software has been configured SHOULD clear the BROADCAST bit to 0. The BOOTP clarifications document discusses the ramifications of the use of the BROADCAST bit [21].
  A server or relay agent sending or relaying a DHCP message directly to a DHCP client (i.e., not to a relay agent specified in the 'giaddr' field) SHOULD examine the BROADCAST bit in the 'flags' field. If this bit is set to 1, the DHCP message SHOULD be sent as an IP broadcast using an IP broadcast address (preferably 0xffffffff) as the IP destination address and the link-layer broadcast address as the link-layer destination address. If the BROADCAST bit is cleared to 0, the message SHOULD be sent as an IP unicast to the IP address specified in the 'yiaddr' field and the link-layer address specified in the 'chaddr' field. If unicasting is not possible, the message MAY be sent as an IP broadcast using an IP broadcast address (preferably 0xffffffff) as the IP destination address and the link- layer broadcast address as the link-layer destination address.
                                                                                                           --from rfc2131

                                                                               Read more: http://www.faqs.org/rfcs/rfc2131.html#ixzz0rO3BaRDw
 (1) 根据上面所说,原来DHCP服务器的offer与ack阶段既可以使用单播的方式又可以使用广播的方式,这主要取决于服务器在offer阶段对BROADCAST位的置位情况,如果置位为1,则DHCP服务器使用广播的方式回应,否则使用单播的方式回应。无图无真相,马上上图证明这一结论.
                                              (物理机xp与tp-link路由器:offer与ack阶段使用单播方式)
  (2)再看看此过程offer阶段的BROADCAST的置位情况,如下图:
 
 (3)接下来再看看,本机的虚拟网卡vnet1与dynamips下模拟的cisco路由器的DHCP过程,如下图:
                                           (物理机xp的虚拟网卡vnet1与cisco3620路由器:offer与ack阶段使用广播方式)
  (4)再看看此过程offer阶段的BROADCAST的置位情况,如下图:
  呵呵,苦战了几天,终于找到了答案,看来搞技术的人,找一个solution还是需要时间的呀,不过有付出肯定是有回报嘀!!

原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 车钥匙没有电了怎么办 起亚k3钥匙没电怎么办 汽车摇控钥匙失灵了怎么办 逍客钥匙没有电怎么办 车钥匙芯片坏了怎么办 车钥匙密码丢了怎么办 遥控车钥匙丢了怎么办 车备用钥匙丢了怎么办 2把车钥匙丢了怎么办 汽车遥控钥匙丢了怎么办 车钥匙忘在车里怎么办 轩逸钥匙没电了怎么办 车钥匙锁后备箱怎么办 死飞车掉漆了怎么办 被吸血蝙蝠咬了怎么办 pos失败钱扣了怎么办 现金支票写错了怎么办 公路上汽车坏了怎么办 驾图盒子绑定过怎么办 车在路上没油了怎么办 狂野飙车8闪退怎么办 宜家会员卡没带怎么办 飞猪机票买贵了怎么办 发现机票买贵了怎么办 埋线双眼皮松了怎么办 吸气时左胸口疼怎么办 兰芝隔离有气泡怎么办 19岁眼部有皱纹怎么办 三星s4开不了机怎么办 三星手机变砖了怎么办 面霜一次用多了怎么办 午觉睡多了头疼怎么办 下午睡多了头疼怎么办 白天睡久了头疼怎么办 睡觉睡多了头痛怎么办 泡菜坛子水少了怎么办 咸菜坛子生花了怎么办 四川泡菜生花了怎么办 三岁宝宝说话不清楚怎么办 电脑读不出来u盘怎么办 跳绳的时候漏尿怎么办