Skip to content

Interface matching uses stale legacy mac_address on NetBox >= 4.2, BMC port merged into vmk0 on every run #584

Closed

Description

@tfoks

Description

With a vmware source and a check_redfish source syncing the same ESXi hosts (Lenovo ThinkSystem with XCC), the XCC port never gets its own interface. On every run it's merged into the ESXi vmk0 interface. The XCC IP is moved to vmk0, the host's management IP is removed from it, and the device's primary_ip4 is unset.

In NetBox, vmk0 on these hosts had the XCC MAC address as its primary MAC (left over from an earlier run). The two sources then undo each other's work:

  1. The VMware source sets the primary MAC of vmk0 to its own 00:50:56:… MAC address.
  2. The check_redfish source still sees the XCC MAC on vmk0, matches the XCC port to it and sets the XCC MAC as primary MAC again.

Log of one host over a single run:

INFO: Interface 'vmk0 (esxi01)' attribute 'primary_mac_address' changed from 'AA:BB:CC:00:00:05' to '00:50:56:00:00:01'
...
DEBUG: Parsing inventory file /opt/netbox-sync/inventory/esxi01-xcc.json
INFO: Ip address '10.0.10.172/22' attribute 'assigned_object_id' changed from 'None' to 'vmk0 (esxi01)'
INFO: IP address is no longer assigned to vmk0 (esxi01) and therefore removed from this interface
INFO: Setting attribute 'primary_ip4' for 'esxi01' to None

In my environment this affected several Lenovo hosts synced by both sources.

Cause

From NetBox 4.2 on, add_update_interface() only maintains the interface's primary_mac_address object. The legacy mac_address field of the interface keeps the value NetBox returned when the data was read and is never updated during a run.

map_object_interfaces_to_current_interfaces() in module/sources/common/source_base.py still matches on data.mac_address. Once a source changes an interface's primary MAC address, every source running after it matches against the old value.

Proposed fix

On NetBox >= 4.2, use the MAC address of the interface's primary_mac_address object for matching. Older NetBox versions keep using mac_address.

Environment

  • netbox-sync 1.9.0
  • NetBox 4.7.2
  • vCenter 8.0.3, Lenovo XClarity Controller inventory files from check_redfish

Activity

  1. semx commented on Oct 8, 2026

    @semx
    Collaborator

    Confirmed on a NetBox 4.7.2: with the BMC MAC left on vmk0 as its primary MAC, vmk0 is turned into the BMC interface on every run and the device loses its primary IP; with #585 the BMC port gets its own interface and a second run changes nothing. Review in #585.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions