gpt4 book ai didi

dhcp - 为什么 DHCP 请求和确认消息是广播而不是单播?

转载 作者:行者123 更新时间:2023-12-02 07:44:04 31 4
gpt4 key购买 nike

在 DORA 过程的“请求”部分,客户端知道 DHCP 服务器的 IP 和 MAC 地址(因为 Offer 中发送的 IP 数据报具有此信息)。那么,如果目的地已知,为什么请求仍然广播到网络上的每台机器?

与 DORA 过程的“Ack”部分类似,客户端的 IP 地址现在已在其中成功设置并为 DHCP 服务器所知。为什么它仍然广播消息?

最佳答案

当网络上有多个 DHCP 服务器并且客户端收到来自 RFC 2131 Section 3.1 的多个 OFFER 响应时,会广播 REQUEST。 :

The servers receive the DHCPREQUEST broadcast from the client.Those servers not selected by the DHCPREQUEST message use themessage as notification that the client has declined that server'soffer. The server selected in the DHCPREQUEST message commits thebinding for the client to persistent storage and responds with aDHCPACK message containing the configuration parameters for therequesting client.

来自服务器的 ACK 可能并不总是广播数据包,但在您检查的情况下可能是。 DHCP 协议(protocol)的一部分允许启用 DHCPOFFER、DHCPACK 和 DHCPNAK 消息的广播目的地。这是必要的,因为某些 TCP/IP 堆栈在完全声明 IP 地址并将其分配给网络接口(interface)之前无法接收单播数据报。来自 RFC 2131 Section 4.1:

Normally, DHCP servers and BOOTP relay agents attempt to deliverDHCPOFFER, DHCPACK and DHCPNAK messages directly to the client usinguicast delivery. The IP destination address (in the IP header) isset to the DHCP 'yiaddr' address and the link-layer destinationaddress is set to the DHCP 'chaddr' address. Unfortunately, someclient implementations are unable to receive such unicast IPdatagrams until the implementation has been configured with a validIP address (leading to a deadlock in which the client's IP addresscannot be delivered until the client has been configured with an IPaddress).

A client that cannot receive unicast IP datagrams until its protocolsoftware has been configured with an IP address SHOULD set theBROADCAST bit in the 'flags' field to 1 in any DHCPDISCOVER orDHCPREQUEST messages that client sends. The BROADCAST bit willprovide a hint to the DHCP server and BOOTP relay agent to broadcastany messages to the client on the client's subnet.

关于dhcp - 为什么 DHCP 请求和确认消息是广播而不是单播?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32068586/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com