客户端未从某些 DHCP 服务器获取地址

Luc*_*lon 5 dhcp ethernet embedded wireshark dhcp-server

我正在研究一些应该通过以太网连接到大型网络(数百个设备)并且应该使用 DHCP 协议进行配置的嵌入式设备。我所经历的是,显然设备在某些网络中获得了地址,但在其他网络中却没有。我设置了一个只有一个客户端、一个交换机和一个 DHCP 服务器 (Ubuntu Linux) 的测试网络。地址已正确分配,DHCP 服务器日志显示 DORA 序列。

我尝试将同一个客户端连接到带有 DHCP 服务器的普通家用路由器(它是我的家用路由器,所以它应该可以正常工作)并且客户端没有获取 IP 地址。这是设备的序列转储:

No.     Time           Source                Destination           Protocol Length Info
     86 26.515684000   ::                    ff02::16              ICMPv6   90     Multicast Listener Report Message v2

Frame 86: 90 bytes on wire (720 bits), 90 bytes captured (720 bits) on interface 0
Ethernet II, Src: DavicomS_91:de:41 (00:60:6e:91:de:41), Dst: IPv6mcast_00:00:00:16 (33:33:00:00:00:16)
Internet Protocol Version 6, Src: :: (::), Dst: ff02::16 (ff02::16)
Internet Control Message Protocol v6

No.     Time           Source                Destination           Protocol Length Info
     87 26.515688000   ::                    ff02::1:ff91:de41     ICMPv6   78     Neighbor Solicitation for fe80::260:6eff:fe91:de41

Frame 87: 78 bytes on wire (624 bits), 78 bytes captured (624 bits) on interface 0
Ethernet II, Src: DavicomS_91:de:41 (00:60:6e:91:de:41), Dst: IPv6mcast_ff:91:de:41 (33:33:ff:91:de:41)
Internet Protocol Version 6, Src: :: (::), Dst: ff02::1:ff91:de41 (ff02::1:ff91:de41)
Internet Control Message Protocol v6

No.     Time           Source                Destination           Protocol Length Info
     88 26.596056000   0.0.0.0               255.255.255.255       DHCP     371    DHCP Discover - Transaction ID 0xb444e919

Frame 88: 371 bytes on wire (2968 bits), 371 bytes captured (2968 bits) on interface 0
Ethernet II, Src: DavicomS_91:de:41 (00:60:6e:91:de:41), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol Version 4, Src: 0.0.0.0 (0.0.0.0), Dst: 255.255.255.255 (255.255.255.255)
User Datagram Protocol, Src Port: bootpc (68), Dst Port: bootps (67)
Bootstrap Protocol
    Message type: Boot Request (1)
    Hardware type: Ethernet
    Hardware address length: 6
    Hops: 0
    Transaction ID: 0xb444e919
    Seconds elapsed: 0
    Bootp flags: 0x0000 (Unicast)
    Client IP address: 0.0.0.0 (0.0.0.0)
    Your (client) IP address: 0.0.0.0 (0.0.0.0)
    Next server IP address: 0.0.0.0 (0.0.0.0)
    Relay agent IP address: 0.0.0.0 (0.0.0.0)
    Client MAC address: DavicomS_91:de:41 (00:60:6e:91:de:41)
    Client hardware address padding: 00000000000000000000
    Server host name not given
    Boot file name not given
    Magic cookie: DHCP
    Option: (53) DHCP Message Type
    Option: (57) Maximum DHCP Message Size
    Option: (60) Vendor class identifier
    Option: (12) Host Name
    Option: (55) Parameter Request List
    Option: (255) End

No.     Time           Source                Destination           Protocol Length Info
     94 27.515730000   fe80::260:6eff:fe91:de41 ff02::2               ICMPv6   70     Router Solicitation from 00:60:6e:91:de:41

Frame 94: 70 bytes on wire (560 bits), 70 bytes captured (560 bits) on interface 0
Ethernet II, Src: DavicomS_91:de:41 (00:60:6e:91:de:41), Dst: IPv6mcast_00:00:00:02 (33:33:00:00:00:02)
Internet Protocol Version 6, Src: fe80::260:6eff:fe91:de41 (fe80::260:6eff:fe91:de41), Dst: ff02::2 (ff02::2)
Internet Control Message Protocol v6

No.     Time           Source                Destination           Protocol Length Info
    119 30.427837000   0.0.0.0               255.255.255.255       DHCP     371    DHCP Discover - Transaction ID 0xb444e919

Frame 119: 371 bytes on wire (2968 bits), 371 bytes captured (2968 bits) on interface 0
Ethernet II, Src: DavicomS_91:de:41 (00:60:6e:91:de:41), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol Version 4, Src: 0.0.0.0 (0.0.0.0), Dst: 255.255.255.255 (255.255.255.255)
User Datagram Protocol, Src Port: bootpc (68), Dst Port: bootps (67)
Bootstrap Protocol
    Message type: Boot Request (1)
    Hardware type: Ethernet
    Hardware address length: 6
    Hops: 0
    Transaction ID: 0xb444e919
    Seconds elapsed: 4
    Bootp flags: 0x0000 (Unicast)
    Client IP address: 0.0.0.0 (0.0.0.0)
    Your (client) IP address: 0.0.0.0 (0.0.0.0)
    Next server IP address: 0.0.0.0 (0.0.0.0)
    Relay agent IP address: 0.0.0.0 (0.0.0.0)
    Client MAC address: DavicomS_91:de:41 (00:60:6e:91:de:41)
    Client hardware address padding: 00000000000000000000
    Server host name not given
    Boot file name not given
    Magic cookie: DHCP
    Option: (53) DHCP Message Type
    Option: (57) Maximum DHCP Message Size
    Option: (60) Vendor class identifier
    Option: (12) Host Name
    Option: (55) Parameter Request List
    Option: (255) End

No.     Time           Source                Destination           Protocol Length Info
    122 30.985580000   fe80::260:6eff:fe91:de41 ff02::16              ICMPv6   90     Multicast Listener Report Message v2

Frame 122: 90 bytes on wire (720 bits), 90 bytes captured (720 bits) on interface 0
Ethernet II, Src: DavicomS_91:de:41 (00:60:6e:91:de:41), Dst: IPv6mcast_00:00:00:16 (33:33:00:00:00:16)
Internet Protocol Version 6, Src: fe80::260:6eff:fe91:de41 (fe80::260:6eff:fe91:de41), Dst: ff02::16 (ff02::16)
Internet Control Message Protocol v6

No.     Time           Source                Destination           Protocol Length Info
    127 31.525478000   fe80::260:6eff:fe91:de41 ff02::2               ICMPv6   70     Router Solicitation from 00:60:6e:91:de:41

Frame 127: 70 bytes on wire (560 bits), 70 bytes captured (560 bits) on interface 0
Ethernet II, Src: DavicomS_91:de:41 (00:60:6e:91:de:41), Dst: IPv6mcast_00:00:00:02 (33:33:00:00:00:02)
Internet Protocol Version 6, Src: fe80::260:6eff:fe91:de41 (fe80::260:6eff:fe91:de41), Dst: ff02::2 (ff02::2)
Internet Control Message Protocol v6

No.     Time           Source                Destination           Protocol Length Info
    138 35.535297000   fe80::260:6eff:fe91:de41 ff02::2               ICMPv6   70     Router Solicitation from 00:60:6e:91:de:41

Frame 138: 70 bytes on wire (560 bits), 70 bytes captured (560 bits) on interface 0
Ethernet II, Src: DavicomS_91:de:41 (00:60:6e:91:de:41), Dst: IPv6mcast_00:00:00:02 (33:33:00:00:00:02)
Internet Protocol Version 6, Src: fe80::260:6eff:fe91:de41 (fe80::260:6eff:fe91:de41), Dst: ff02::2 (ff02::2)
Internet Control Message Protocol v6

No.     Time           Source                Destination           Protocol Length Info
    142 39.405342000   0.0.0.0               255.255.255.255       DHCP     371    DHCP Discover - Transaction ID 0xb444e919

Frame 142: 371 bytes on wire (2968 bits), 371 bytes captured (2968 bits) on interface 0
Ethernet II, Src: DavicomS_91:de:41 (00:60:6e:91:de:41), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol Version 4, Src: 0.0.0.0 (0.0.0.0), Dst: 255.255.255.255 (255.255.255.255)
User Datagram Protocol, Src Port: bootpc (68), Dst Port: bootps (67)
Bootstrap Protocol
    Message type: Boot Request (1)
    Hardware type: Ethernet
    Hardware address length: 6
    Hops: 0
    Transaction ID: 0xb444e919
    Seconds elapsed: 13
    Bootp flags: 0x0000 (Unicast)
    Client IP address: 0.0.0.0 (0.0.0.0)
    Your (client) IP address: 0.0.0.0 (0.0.0.0)
    Next server IP address: 0.0.0.0 (0.0.0.0)
    Relay agent IP address: 0.0.0.0 (0.0.0.0)
    Client MAC address: DavicomS_91:de:41 (00:60:6e:91:de:41)
    Client hardware address padding: 00000000000000000000
    Server host name not given
    Boot file name not given
    Magic cookie: DHCP
    Option: (53) DHCP Message Type
    Option: (57) Maximum DHCP Message Size
    Option: (60) Vendor class identifier
    Option: (12) Host Name
    Option: (55) Parameter Request List
    Option: (255) End

No.     Time           Source                Destination           Protocol Length Info
    392 55.264802000   0.0.0.0               255.255.255.255       DHCP     371    DHCP Discover - Transaction ID 0xb444e919

Frame 392: 371 bytes on wire (2968 bits), 371 bytes captured (2968 bits) on interface 0
Ethernet II, Src: DavicomS_91:de:41 (00:60:6e:91:de:41), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol Version 4, Src: 0.0.0.0 (0.0.0.0), Dst: 255.255.255.255 (255.255.255.255)
User Datagram Protocol, Src Port: bootpc (68), Dst Port: bootps (67)
Bootstrap Protocol
    Message type: Boot Request (1)
    Hardware type: Ethernet
    Hardware address length: 6
    Hops: 0
    Transaction ID: 0xb444e919
    Seconds elapsed: 29
    Bootp flags: 0x0000 (Unicast)
    Client IP address: 0.0.0.0 (0.0.0.0)
    Your (client) IP address: 0.0.0.0 (0.0.0.0)
    Next server IP address: 0.0.0.0 (0.0.0.0)
    Relay agent IP address: 0.0.0.0 (0.0.0.0)
    Client MAC address: DavicomS_91:de:41 (00:60:6e:91:de:41)
    Client hardware address padding: 00000000000000000000
    Server host name not given
    Boot file name not given
    Magic cookie: DHCP
    Option: (53) DHCP Message Type
    Option: (57) Maximum DHCP Message Size
    Option: (60) Vendor class identifier
    Option: (12) Host Name
    Option: (55) Parameter Request List
    Option: (255) End
Run Code Online (Sandbox Code Playgroud)

我的理解是 DHCP 发现没有得到答复。这样对吗?你知道为什么吗?

编辑:我尝试使用wireshark再次检查数据包,我可以看到选项选项:(53)DHCP消息类型。通过扩展,我看到了 DHCP 发现。这对我来说似乎是 DHCP。我还使用wireshark检查了Mac OS X DHCP数据包,我仍然在数据包中看到“消息类型:启动请求(1)”。唯一的区别是不发送 DHCP 发现,仅发送地址的 DHCP 请求。此外,同一个适配器在 Windows 7 下不起作用。

那么,这真的是 bootp 协议吗?你能确认吗?还是DHCP?为什么会发送 DHCP Discover 消息,但没有发回 DHCP Offer?

小智 6

问题是您的客户端不是在说DHCP而是bootp。由于设计限制或配置设置,并非所有dhcp服务器都能处理bootp