【原】关于DHCPServer发包方式的疑难问题解析

在DHCP-Server 向DHCP-Client 动态提供IP地址的四步过程中(DHCPDISCOVER、DHCPOFFER、DHCPREQUEST和DHCPACK),第一、三步(DHCP-Client 至DHCP-Server)通常都采用广播方式进行包发送,但第二、四步(DHCP-Server 至DHCP-Client)却因不同的厂商存在两种不同的实现方法,比如微软采用广播发送而思科采用单播发送,下来我们详细介绍:

 
首先我们来看看RFC 2131 文档中的相关介绍:
//////////////////////////////////////////////////////////////////////////////////////////////////////
Message          Use
   -------         ---
 
   DHCPDISCOVER - Client broadcast to locate available servers.
 
   DHCPOFFER    - Server to client in response to DHCPDISCOVER with
                   offer of configuration parameters.
 
   DHCPREQUEST - Client message to servers either (a) requesting
                   offered parameters from one server and implicitly
                   declining offers from all others, (b) confirming
                   correctness of previously allocated address after,
                   e.g., system reboot, or (c) extending the lease on a
                   particular network address.
 
   DHCPACK      - Server to client with configuration parameters,
                   including committed network address.
//////////////////////////////////////////////////////////////////////////////////////////////////////
 
由此可见,在RFC文档中只对第一步明确做了说明是使用广播发送方式,而后的三步并没有定义采用广播还是单播方式,但对此做了如下解释:
 
 
 
Normally, DHCP servers and BOOTP relay agents attempt to deliver
     DHCPOFFER, DHCPACK and DHCPNAK messages directly to the client using
     uicast delivery. The IP destination address (in the IP header) is
     set to the DHCP 'yiaddr' address and the link-layer destination
     address is set to the DHCP 'chaddr' address. Unfortunately, some
     client implementations are unable to receive such unicast IP
     datagrams until the implementation has been configured with a valid
     IP address (leading to a deadlock in which the client's IP address
     cannot be delivered until the client has been configured with an IP
     address).
 
      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].
     由此可见,RFC中对于DHCP-Server 至DHCP-Client的数据包发送方式也做了两种说明。
 
下来我们看看微软官方文档中的说明:

图片

详细介绍见: http://support.microsoft.com/kb/169289
 
最后我们看看思科官方文档中的说明:
  图片
因此,微软和思科在实现DHCP时采用了不同的包发送方式,所以在学习的过程中我们可能遇到两种不同的关于DHCP 实现过程中包发送机制,而这两种机制均符合RFC 文档的要求的。

你可能感兴趣的:(职场,广播,DHCP,休闲)