• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

Duplicate DHCP leases

Scheduled Pinned Locked Moved DHCP and DNS
duplicate dhcpduplicate lease
10 Posts 2 Posters 1.4k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S
    swinster
    last edited by swinster Aug 24, 2022, 6:01 PM Aug 24, 2022, 6:00 PM

    Hi,

    I seem to have an odd issue with my DHCP configuration. I have just deployed two identical VMware appliances from Bitnami. VMware has the sense to randomise the MAC address assigned to the vNICs, but both VMs ended up with the same IP address. I can only see one MAC entry on the GUI, but there are multiple lease entries in the DHCP lease file (now 6 entries, although this was 3 when I last looked). The really odd thing is that when looking at the GUI, sometimes the MAC address shows as from VM 1, and other times it shows as from VM 2 (I guess the last one that requested the lease), but they do not both appear at the same time (as obviously, that would likely offer two unique IP addresses). Initially, I only saw one MAC in the lease file, but now both seem to appear.

    For example, I have just booted the VMs in order (waiting around 1 minute between each boot), and here is the latest DHCP lease file entries:

    lease 172.16.199.17 {
      starts 3 2022/08/24 16:56:11;
      ends 3 2022/08/24 18:56:11;
      cltt 3 2022/08/24 16:56:11;
      binding state active;
      next binding state free;
      rewind binding state free;
      hardware ethernet 00:0c:29:85:95:6a;
      uid "\377\237n\205$\000\002\000\000\253\021\226\031\230\020\326;\364\205";
      client-hostname "debian";
    }
    
    lease 172.16.199.17 {
      starts 3 2022/08/24 16:56:11;
      ends 3 2022/08/24 17:07:18;
      tstp 3 2022/08/24 17:07:18;
      cltt 3 2022/08/24 16:56:11;
      binding state free;
      hardware ethernet 00:0c:29:85:95:6a;
      uid "\377\237n\205$\000\002\000\000\253\021\226\031\230\020\326;\364\205";
    }
    lease 172.16.199.17 {
      starts 3 2022/08/24 17:08:55;
      ends 3 2022/08/24 19:08:55;
      cltt 3 2022/08/24 17:08:55;
      binding state active;
      next binding state free;
      rewind binding state free;
      hardware ethernet 00:0c:29:85:95:6a;
      uid "\377\237n\205$\000\002\000\000\253\021\226\031\230\020\326;\364\205";
      client-hostname "debian";
    }
    lease 172.16.199.17 {
      starts 3 2022/08/24 17:08:55;
      ends 3 2022/08/24 17:10:03;
      tstp 3 2022/08/24 17:10:03;
      cltt 3 2022/08/24 17:08:55;
      binding state free;
      hardware ethernet 00:0c:29:85:95:6a;
      uid "\377\237n\205$\000\002\000\000\253\021\226\031\230\020\326;\364\205";
    }
    lease 172.16.199.17 {
      starts 3 2022/08/24 17:10:46;
      ends 3 2022/08/24 19:10:46;
      cltt 3 2022/08/24 17:10:46;
      binding state active;
      next binding state free;
      rewind binding state free;
      hardware ethernet 00:0c:29:77:9e:3a;
      uid "\377\237n\205$\000\002\000\000\253\021\226\031\230\020\326;\364\205";
      client-hostname "debian";
    }
    
    lease 172.16.199.17 {
      starts 3 2022/08/24 17:32:59;
      ends 3 2022/08/24 19:32:59;
      cltt 3 2022/08/24 17:32:59;
      binding state active;
      next binding state free;
      rewind binding state free;
      hardware ethernet 00:0c:29:85:95:6a;
      uid "\377\237n\205$\000\002\000\000\253\021\226\031\230\020\326;\364\205";
      client-hostname "debian";
    }
    

    This is an image of the GUI now, showing the MAC of VM2:

    c204e685-5f5c-42cb-95ce-aa0d05a8a92d-image.png

    However, here is an image of the GUI a short while ago, showing the MAC or VM 1
    a456d968-cf6f-4b8c-be47-5bc2aaff1b03-image.png

    I guess I could shut down the VMs and manually remove these entries from the lease file, but I'm wondering why this might be occurring.

    I ran a PCAP on PfSense and noted that the DHCP discover from each includes their unique MAC address but Pfsense issues the same IP address to both. Here are a couple of images from the same PCAP that show the different DHCP dialogues, just highlighting the different DCP Discover packets from both VMs

    375811fd-f9f3-4dfd-9cd8-29302e35f8d0-image.png

    d743358b-8ba4-4b8e-93c3-de45a425813c-image.png

    In addition to all of this, I noted that there are other multiple active DHCP leases contained in the leases file, but for the same MAC - is this normal? Given these leases are for the same thing, I don't think there are any major issues, but again, it doesn't quite feel right.

    For example:

    lease 192.168.199.108 {
      starts 3 2022/08/24 16:15:04;
      ends 3 2022/08/24 18:15:04;
      cltt 3 2022/08/24 16:15:04;
      binding state active;
      next binding state free;
      rewind binding state free;
      hardware ethernet bc:dd:c2:21:db:ac;
      client-hostname "ESP_21DBAC";
    }
    
    lease 192.168.199.108 {
      starts 3 2022/08/24 17:04:18;
      ends 3 2022/08/24 19:04:18;
      cltt 3 2022/08/24 17:04:18;
      binding state active;
      next binding state free;
      rewind binding state free;
      hardware ethernet bc:dd:c2:21:db:ac;
      client-hostname "ESP_21DBAC";
    }
    

    1df7c332-d6d2-4758-8b79-20d87ae273b4-image.png

    Cheers

    1 Reply Last reply Reply Quote 0
    • S
      swinster
      last edited by Aug 25, 2022, 9:38 AM

      FWIW, I left both VMs off overnight just to let the leases expire fully. This morning, the DHCP lease file showed only 1 entry for 172.16.199.17. I decided to remove that entry manually and resave the file then reboot one of the devices.

      That device obtained a lease immediately for 172.16.199.17 (as expected) but interestingly in the pfSense GUI, it shows as offline, which it very much isn't.

      aeb6d032-e36d-4813-9aa2-6136ac480a3b-image.png

      I then rebooted the second VM, and it immediately was issued the same IP address. Now the GUI has been updated with the MAC address of the second VM and it is now denoted as online.

      aabb3f48-7b00-46ba-8bcb-4f90451526aa-image.png

      I am confused.

      D 1 Reply Last reply Aug 28, 2022, 12:26 PM Reply Quote 0
      • S
        swinster
        last edited by swinster Aug 25, 2022, 9:55 AM Aug 25, 2022, 9:47 AM

        And I'm back to multiple entries in the DHCP lease file, two different MACs but the same IP.

        lease 172.16.199.17 {
          starts 4 2022/08/25 09:25:22;
          ends 4 2022/08/25 11:25:22;
          cltt 4 2022/08/25 09:25:22;
          binding state active;
          next binding state free;
          rewind binding state free;
          hardware ethernet 00:0c:29:77:9e:3a;
          uid "\377\237n\205$\000\002\000\000\253\021\226\031\230\020\326;\364\205";
          client-hostname "debian";
        }
        
        lease 172.16.199.17 {
          starts 4 2022/08/25 09:33:34;
          ends 4 2022/08/25 11:33:34;
          cltt 4 2022/08/25 09:33:34;
          binding state active;
          next binding state free;
          rewind binding state free;
          hardware ethernet 00:0c:29:85:95:6a;
          uid "\377\237n\205$\000\002\000\000\253\021\226\031\230\020\326;\364\205";
          client-hostname "debian";
        }
        
        1 Reply Last reply Reply Quote 0
        • S
          swinster
          last edited by swinster Aug 25, 2022, 9:54 AM Aug 25, 2022, 9:51 AM

          Looks like the UID is the same for both VMs which I guess is somewhat understandable as they are built from the same OVA file. Obviously, the hostname is also identicle as well. Not sure if the UID should somehow be manipulated to be unique when the OVA is deployed though, or if this has an impact on how Pfsense issue a DHCP lease.

          1 Reply Last reply Reply Quote 0
          • S
            swinster
            last edited by swinster Aug 25, 2022, 11:28 AM Aug 25, 2022, 10:39 AM

            OK, I switched off the VMs, then checked the "Ignore client identifiers" box for the DHCP server for this interface, removed the leases from the DHCP file, and restarted the VMs. Now, the VMs have been assigned unique IP addresses 🎉 However, I do wonder if this is the way it should be - goese to read https://www.rfc-editor.org/rfc/rfc2131#page-26

            TBH, I was unaware that, whatever these UIDs are, they play such a crucial role in DHCP address allocation. I wonder if this is something specific to the way Bitnami create their VMware appliances and if this could be modified by them. I have not seen this with any other VMs created from the same OVA previously.

            1 Reply Last reply Reply Quote 0
            • S
              swinster
              last edited by swinster Aug 25, 2022, 10:47 AM Aug 25, 2022, 10:46 AM

              So, I guess the last thing to figure out is why there are duplicate DHCP lease entries for other devices, and if these would be harmful or how they can be overcome (if needs be).

              1 Reply Last reply Reply Quote 0
              • S
                swinster
                last edited by swinster Aug 25, 2022, 12:16 PM Aug 25, 2022, 11:55 AM

                Back to the original issue, I found this. From https://www.rfc-editor.org/rfc/rfc2131#section-2, we see some stuff about client identifiers:

                °The 'client identifier' chosen by a
                DHCP client MUST be unique to that client within the subnet to which
                the client is attached. If the client uses a 'client identifier' in
                one message, it MUST use that same identifier in all subsequent
                messages, to ensure that all servers correctly identify the client.°(information text)

                So, it would appear as if the Bitnami VMs are being a bit naughty here 🤔. I also noted https://www.rfc-editor.org/rfc/rfc2131#section-4.2:

                °A DHCP server needs to use some unique identifier to associate a
                client with its lease. The client MAY choose to explicitly provide
                the identifier through the 'client identifier' option. If the client
                supplies a 'client identifier', the client MUST use the same 'client
                identifier' in all subsequent messages, and the server MUST use that
                identifier to identify the client.°(information text)

                So, it is entirely optional for a client to send the client identifier, but f they do, the server MUST use it to identify the client.

                1 Reply Last reply Reply Quote 0
                • S
                  swinster
                  last edited by Aug 26, 2022, 1:05 PM

                  This post is deleted!
                  1 Reply Last reply Reply Quote 0
                  • S
                    swinster
                    last edited by Aug 26, 2022, 4:06 PM

                    So, it turn out that the Bitnami boys and girls had left the file /etc/machine-id baked into the OVA containing a machine ID 🤦. They use systemd to manage their networking and by default, systemd and networkd uses a hash of this machine ID to generate a UID that the DHCP client will use (if not otherwise defined) - or so I am lead to believe ;)

                    1 Reply Last reply Reply Quote 1
                    • D
                      Derelict LAYER 8 Netgate @swinster
                      last edited by Aug 28, 2022, 12:26 PM

                      @swinster said in Duplicate DHCP leases:

                      That device obtained a lease immediately for 172.16.199.17 (as expected) but interestingly in the pfSense GUI, it shows as offline, which it very much isn't.

                      That Online/Offline status is determined by whether pfSense itself has an ARP entry for that host. It will only have an ARP entry if it has passed unicast traffic with that host from the firewall itself in the recent past. It is perfectly normal for that to show offline. Ping it from the firewall and it will show online if ARP is resolved.

                      I believe the more-recent linux DHCP clients are doing more with the machine-id than other clients do. I have seen that behavior before as well.

                      Chattanooga, Tennessee, USA
                      A comprehensive network diagram is worth 10,000 words and 15 conference calls.
                      DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
                      Do Not Chat For Help! NO_WAN_EGRESS(TM)

                      1 Reply Last reply Reply Quote 0
                      10 out of 10
                      • First post
                        10/10
                        Last post
                      Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
                        This community forum collects and processes your personal information.
                        consent.not_received