Skip to content
Wireshark Wiki 中文翻译整理专题首页原始页面

动态主机配置协议 (DHCP)

DHCP 是一种 client/server 协议,用于向 DHCP client 动态分配 IP-address 参数(以及其他内容)。它作为 BOOTP 的一个 option 实现。

一些操作系统(包括 Windows 98 及更高版本和 Mac OS 8.5 及更高版本)会在没有可用 DHCP server 时使用 APIPA 在本地分配 IP-address。

历史

  • RFC1531 "Dynamic Host Configuration Protocol" 1993 年 10 月,被 RFC1541 取代

  • RFC1541 "Dynamic Host Configuration Protocol" 1993 年 10 月,被 RFC2131 取代

  • RFC2131 "Dynamic Host Configuration Protocol" 1997 年 3 月,由 RFC3396 更新

  • RFC3396 "Encoding Long Options in the Dynamic Host Configuration Protocol (DHCPv4)" 2002 年 11 月

协议依赖

  • BOOTP:DHCP 使用 BOOTP 作为其传输协议。

示例流量

Wireshark

DHCP dissector 功能完整。

Windows Endian Bug 检测

Microsoft Windows 的大多数版本都会错误地将 secs 字段在线路上编码为 little-endian。Wireshark 会尝试检测这一点,并在 packet detail 中显示消息 "little endian bug?"。在下面的示例中,secs 值 0x0e00(3584,或接近一小时)由 Windows XP client 发送,尽管该 client 并没有重试那么久。将该值解释为 0x000e(14)则与自第一次请求(packet #3)以来经过的时间相匹配。

首选项设置

  • Decode Option 85 as String:Novell Servers option 85 可以配置为字符串而不是地址。

  • PacketCable CCC protocol version:PacketCable CCC 协议版本。

  • PacketCable CCC option:PacketCable CableLabs Client Configuration 的 Option Number。

  • Custom BootP/DHCP Options (Excl. suboptions):定义 options 的自定义解释

示例捕获文件

  • SampleCaptures/dhcp.pcap

  • SampleCaptures/dhcp-auth.pcap.gz

  • SampleCaptures/PRIV_bootp-both_overload.pcap

  • SampleCaptures/PRIV_bootp-both_overload_empty-no_end.pcap

显示过滤器

由于 DHCP 是作为 BOOTP 的一个 option 实现的,因此你只能按 BOOTP messages 过滤。BOOTP 显示过滤器字段的完整列表可以在显示过滤器参考中找到

仅显示基于 BOOTP 的流量:

 bootp

捕获过滤器

由于 DHCP 是作为 BOOTP 的一个 option 实现的,因此你只能按 BOOTP messages 过滤。如果 BOOTP 协议要去往或来自任意端口,捕获时无法直接过滤 BOOTP 协议。不过,BOOTP 流量通常会去往或来自端口 67 和 68,进出这些端口的流量通常是 BOOTP 流量,因此你可以按这些端口号过滤。

仅捕获进出端口 67 和 68 的流量:

 port 67 or port 68

在许多系统上,你可以说 "port bootps" 而不是 "port 67",并说 "port bootpc" 而不是 "port 68"。

外部链接

  • 在 RFC 搜索中,你可以搜索 DHCP,因为有很多 DHCP options 分散在多个 RFC 中

讨论

little endian bug 怎么回事?"seconds elasped" 字段中有一些错误,但没有任何关于这个问题的说明。(我在 DHCPInform request 上遇到了这个错误,该 request 被加载了两次,间隔 3 秒,其中一个 request 包含这个错误)- CortoGueguen

如果你认为 Wireshark 的 DHCP dissector 中有 bug,请在 Wireshark Bugzilla 上提交 bug,或发送邮件到 wireshark-users mailing list;这里不是报告 Wireshark bug 的地方。-Guy Harris

我认为 CortoGueguen 可能指的是 Wireshark 显示的一条错误消息。我已经添加了说明和截图。- GeraldCombs

是的,就是这个,GeraldCombs,非常感谢 - CortoGueguen **

Imported from https://wiki.wireshark.org/DHCP on 2020-08-11 23:13:29 UTC

原始页面图片

dhcp-ws.png
dhcp-ws.png
dhcp-le-bug.png
dhcp-le-bug.png

相关 Wireshark Wiki 页面

网络分析技术档案