有关DHCP服务器 offer ack 包单播广播问题

DHCP服务器根据client的giaddr、ciaddr字段和broadcast bit位来决定offer和ack包的发送方式。当giaddr非零,消息发送到中继地址;ciaddr非零且giaddr为零时,单播到ciaddr地址;若ciaddr和giaddr皆为零,broadcast bit位设,则广播到0xffffffff,未设则单播到client的硬件地址和yiaddr。实验显示,不同的客户端可能设置不同的broadcast bit位,导致服务器响应的包类型不同。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

     通常情况下,都会说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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值