Duplicate IP addresses from dhcp server

My rb952 router’s DHCP server (ROS v6.46.6) is giving out the same IP address to different machines at the same time. Specifically, I have two VirtualBox VMs; when I boot them they both get the same IP address. The router’s dhcp server is configured with a pool of 10.1.65.65-96 with .65, .66 and .67 statically assigned.

Below is a Wireshark dump of the dhcp conversation (filtered on UDP between ports 67 and 68). Participants:
VM#1: 080027009A8D
VM#2: 080027AC666C
rb952 router: 64D154A36FE7 (10.1.65.254)

VM#2 was booted about 6 seconds after VM#1. VM#2 makes a dhcp DISCOVER request with MAC address (…666C) that is different than VM#1 (…9A8D) but the OFFER from the router is for the same IP address (.68) that was given out 6 seconds earlier to VM#1.

The router log file has these (abbreviated) entries:
May/15/2020 12:07:32 defconf assigned 10.1.65.68 to 08:00:27:00:9A:8D
May/15/2020 12:07:38 defconf deassigned 10.1.65.68 from 08:00:27:00:9A:8D
May/15/2020 12:07:38 defconf assigned 10.1.65.68 to 08:00:27:00:9A:8D
May/15/2020 12:17:38 defconf deassigned 10.1.65.68 from 08:00:27:00:9A:8D

Why does the second “assigned” report the same MAC address as the first (…9A8D) when the packet dump below shows the second request is from …666C?

I should mention that both VMs have the same clientid and hostname in the DISCOVER request (having been cloned from the same parent VM; but with different MAC addresses). Is it possible the the dhcp server ignores the differing MAC addresses because the clientid’s are the same? I also do not know why the packets coming from the VM are duplicated but assume this would not affect duplicate IP assignment that is the big problem?

Packet capture:

VM#1 boots and get IP address .68

#1      Time           Source                Destination           Protocol Length Info
        0.000000000    0.0.0.0               255.255.255.255       DHCP     329    DHCP Discover - Transaction ID 0x5d9f4d68
Frame 1: 329 bytes on wire (2632 bits), 329 bytes captured (2632 bits) on interface 0
Ethernet II, Src: PcsCompu_00:9a:8d (08:00:27:00:9a:8d), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol Version 4, Src: 0.0.0.0, Dst: 255.255.255.255
User Datagram Protocol, Src Port: 68, Dst Port: 67
Bootstrap Protocol (Discover)

#2      Time           Source                Destination           Protocol Length Info
        0.000006277    0.0.0.0               255.255.255.255       DHCP     329    DHCP Discover - Transaction ID 0x5d9f4d68
Frame 2: 329 bytes on wire (2632 bits), 329 bytes captured (2632 bits) on interface 0
Ethernet II, Src: PcsCompu_00:9a:8d (08:00:27:00:9a:8d), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol Version 4, Src: 0.0.0.0, Dst: 255.255.255.255
User Datagram Protocol, Src Port: 68, Dst Port: 67
Bootstrap Protocol (Discover)

#3      Time           Source                Destination           Protocol Length Info
        0.581032219    10.1.65.254           10.1.65.68            DHCP     342    DHCP Offer    - Transaction ID 0x5d9f4d68
Frame 3: 342 bytes on wire (2736 bits), 342 bytes captured (2736 bits) on interface 0
Ethernet II, Src: Routerbo_a3:6f:e7 (64:d1:54:a3:6f:e7), Dst: PcsCompu_00:9a:8d (08:00:27:00:9a:8d)
Internet Protocol Version 4, Src: 10.1.65.254, Dst: 10.1.65.68
User Datagram Protocol, Src Port: 67, Dst Port: 68
Bootstrap Protocol (Offer)

#4      Time           Source                Destination           Protocol Length Info
        0.581217715    0.0.0.0               255.255.255.255       DHCP     341    DHCP Request  - Transaction ID 0x5d9f4d68
Frame 4: 341 bytes on wire (2728 bits), 341 bytes captured (2728 bits) on interface 0
Ethernet II, Src: PcsCompu_00:9a:8d (08:00:27:00:9a:8d), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol Version 4, Src: 0.0.0.0, Dst: 255.255.255.255
User Datagram Protocol, Src Port: 68, Dst Port: 67
Bootstrap Protocol (Request)

#5      Time           Source                Destination           Protocol Length Info
        0.581220548    0.0.0.0               255.255.255.255       DHCP     341    DHCP Request  - Transaction ID 0x5d9f4d68
Frame 5: 341 bytes on wire (2728 bits), 341 bytes captured (2728 bits) on interface 0
Ethernet II, Src: PcsCompu_00:9a:8d (08:00:27:00:9a:8d), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol Version 4, Src: 0.0.0.0, Dst: 255.255.255.255
User Datagram Protocol, Src Port: 68, Dst Port: 67
Bootstrap Protocol (Request)

#6      Time           Source                Destination           Protocol Length Info
        0.582293397    10.1.65.254           10.1.65.68            DHCP     342    DHCP ACK      - Transaction ID 0x5d9f4d68
Frame 6: 342 bytes on wire (2736 bits), 342 bytes captured (2736 bits) on interface 0
Ethernet II, Src: Routerbo_a3:6f:e7 (64:d1:54:a3:6f:e7), Dst: PcsCompu_00:9a:8d (08:00:27:00:9a:8d)
Internet Protocol Version 4, Src: 10.1.65.254, Dst: 10.1.65.68
User Datagram Protocol, Src Port: 67, Dst Port: 68
Bootstrap Protocol (ACK)

VM#2 boots and gets the same .68 address.

#7      Time           Source                Destination           Protocol Length Info
        5.959033379    0.0.0.0               255.255.255.255       DHCP     329    DHCP Discover - Transaction ID 0xceb7d8a5
Frame 7: 329 bytes on wire (2632 bits), 329 bytes captured (2632 bits) on interface 0
Ethernet II, Src: PcsCompu_ac:66:6c (08:00:27:ac:66:6c), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol Version 4, Src: 0.0.0.0, Dst: 255.255.255.255
User Datagram Protocol, Src Port: 68, Dst Port: 67
Bootstrap Protocol (Discover)

#8      Time           Source                Destination           Protocol Length Info
        5.959038312    0.0.0.0               255.255.255.255       DHCP     329    DHCP Discover - Transaction ID 0xceb7d8a5
Frame 8: 329 bytes on wire (2632 bits), 329 bytes captured (2632 bits) on interface 0
Ethernet II, Src: PcsCompu_ac:66:6c (08:00:27:ac:66:6c), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol Version 4, Src: 0.0.0.0, Dst: 255.255.255.255
User Datagram Protocol, Src Port: 68, Dst Port: 67
Bootstrap Protocol (Discover)

#9      Time           Source                Destination           Protocol Length Info
        5.987342604    10.1.65.254           10.1.65.68            DHCP     342    DHCP Offer    - Transaction ID 0xceb7d8a5
Frame 9: 342 bytes on wire (2736 bits), 342 bytes captured (2736 bits) on interface 0
Ethernet II, Src: Routerbo_a3:6f:e7 (64:d1:54:a3:6f:e7), Dst: PcsCompu_ac:66:6c (08:00:27:ac:66:6c)
Internet Protocol Version 4, Src: 10.1.65.254, Dst: 10.1.65.68
User Datagram Protocol, Src Port: 67, Dst Port: 68
Bootstrap Protocol (Offer)

#10     Time           Source                Destination           Protocol Length Info
        5.987619370    0.0.0.0               255.255.255.255       DHCP     341    DHCP Request  - Transaction ID 0xceb7d8a5
Frame 10: 341 bytes on wire (2728 bits), 341 bytes captured (2728 bits) on interface 0
Ethernet II, Src: PcsCompu_ac:66:6c (08:00:27:ac:66:6c), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol Version 4, Src: 0.0.0.0, Dst: 255.255.255.255
User Datagram Protocol, Src Port: 68, Dst Port: 67
Bootstrap Protocol (Request)

#11     Time           Source                Destination           Protocol Length Info
        5.987624300    0.0.0.0               255.255.255.255       DHCP     341    DHCP Request  - Transaction ID 0xceb7d8a5
Frame 11: 341 bytes on wire (2728 bits), 341 bytes captured (2728 bits) on interface 0
Ethernet II, Src: PcsCompu_ac:66:6c (08:00:27:ac:66:6c), Dst: Broadcast (ff:ff:ff:ff:ff:ff)
Internet Protocol Version 4, Src: 0.0.0.0, Dst: 255.255.255.255
User Datagram Protocol, Src Port: 68, Dst Port: 67
Bootstrap Protocol (Request)

#12     Time           Source                Destination           Protocol Length Info
        5.989030646    10.1.65.254           10.1.65.68            DHCP     342    DHCP ACK      - Transaction ID 0xceb7d8a5
Frame 12: 342 bytes on wire (2736 bits), 342 bytes captured (2736 bits) on interface 0
Ethernet II, Src: Routerbo_a3:6f:e7 (64:d1:54:a3:6f:e7), Dst: PcsCompu_ac:66:6c (08:00:27:ac:66:6c)
Internet Protocol Version 4, Src: 10.1.65.254, Dst: 10.1.65.68
User Datagram Protocol, Src Port: 67, Dst Port: 68
Bootstrap Protocol (ACK)

As you’ve found yourself - in contrary to popular belief, the DHCP server doesn’t care about the source MAC address of the DHCPDISCOVER/DHCPREQUEST coming from the client, but about the Client-ID field in the DHCP part of the packet. This field is typically created from the client’s MAC address, but it is not a rule.

This is specificaly very important when one uses “universal repeater/pseudo bridge” devices. All the devices behind that pseudo bridge request a DHCP address with the MAC address of the repeater in the ethernet header, but they all get a different IP address based on their own MAC address that is in the data field of the DHCP request.
Even some router programmers get confused. As did Draytek in a release some 8 years ago and combined the DHCP MAC table with the ARP MAC table. (To safe space in the router and AP’s probably). They never fixed it since, and I hope it will not contaminate Linux programmers, because it gives conflicts on access control and other check mechanisms. The MAC address in ARP and DHCP is different for the same IP. The DHCP MAC database is a one-to-many database (one MAC multiple IP), the combined database should be a many-to-many because the MAC address can be different. But they just overwrite the MAC address in the DHCP/ARP table. And problems start …

Thanks for the answers. Somehow I’d missed that detail about dhcp. Everything makes sense now.