通常情况下,都会说DHCP Server 这端的offer包和ack包是广播出去的,但是这个在具体情况下是怎么样的呢,通过rfc2131可以知道,这个其实是和client端的broadcast bit位的设置是有关系的,其中有这样一段描述:
If the 'giaddr' field in a DHCP message from a client is non-zero,the server sends any return messages to the 'DHCP server' port on the BOOTP relay agent whose address appears in 'giaddr'. If the 'giaddr' field is zero and the 'ciaddr' field is nonzero, then the server unicasts DHCPOFFER and DHCPACK messages to the address in 'ciaddr'.If 'giaddr' is zero and 'ciaddr' is zero, and the broadcast bit is set, then the server broadcasts DHCPOFFER and DHCPACK messages to 0xffffffff. If the broadcast bit is not set and 'giaddr' is zero and 'ciaddr' is zero, then the server unicasts DHCPOFFER and DHCPACK messages to the client's hardware address and 'yiaddr' address. In all cases, when 'giaddr' is zero, the server broadcasts any DHCPNAK messages to 0xffffffff.
首先说明一下这个giaddr域,rfc中给的描述是Relay agent IP address, used in booting via a relay agent.也就是中继的地址,一般在有中继的情况下都是单播的,目的地址就是该中继的地址。
那么在没有中继的情况下,首先看ciaddr域是否为零,如果不为零,就是单播,目的地址就是该ciaddr域中的地址;如果ciaddr域为零,再看其是否设置了broadcast bit位,如果设置了,就全F地址广播,如果没有设置,就是单播,目的地址是该client的硬件地址(L2)和yiaddr域中的地址(L3)。broadcast bit位是由client端决定的。
The leftmost bit is defined as the BROADCAST (B) flag. The semantics of this flag ar