netbox-sync icon indicating copy to clipboard operation
netbox-sync copied to clipboard

Sync overwrites FHRPGroup assignement

Open ionoci opened this issue 9 months ago • 6 comments

Hi,

i got netbox 2.4.2 and netbox-sync 1.8.0 runnig. It's really synching great. Only two virutal firewalls with CARP addresses assigned as FHRP-groups got an issue. The assignment to the FHRP groups gets reassigned to one of the vNICs of them, although there is a warning the IPs will be skipped cause they are enabled on two VMs.

From the log(DEBUG3) it looks like this:

2025-03-12 07:23:20,727 - DEBUG2: Found existing NetBox IP address object: 192.168.205.1/27
2025-03-12 07:23:20,727 - DEBUG2: Parsing 'IP address' data structure: 192.168.205.1/27
2025-03-12 07:23:20,727 - INFO: Ip address '192.168.205.1/27' attribute 'assigned_object_id' changed from 'None' to 'vNIC 6 (xyz-VLAN-2047u2050-2059Trunk-FIREWALL) (pf31)'
2025-03-12 07:23:20,727 - INFO: Ip address '192.168.205.1/27' attribute 'assigned_object_type' changed from 'ipam.fhrpgroup' to 'virtualization.vminterface'
...
2025-03-12 07:23:54,663 - DEBUG2: Trying to find prefix for IP: 192.168.205.1/27
2025-03-12 07:23:54,664 - DEBUG2: Found IP '192.168.205.1/27' matches site 'xyz-Strasse' prefix '192.168.205.0/27'
2025-03-12 07:23:54,670 - DEBUG: Current interface 'vNIC 6 (xyz-VLAN-2047u2050-2059Trunk-FIREWALL) (pf31)' for IP '192.168.205.1/27' and this one 'vNIC 6 (xyz-VLAN-2047u2050-2059Trunk-FIREWALL) (pf32)' are both enabled. The virtual machine will be checked later again to see if current interface status or association has changed
2025-03-12 07:24:29,197 - DEBUG2: Trying to find prefix for IP: 192.168.205.1/27
2025-03-12 07:24:29,197 - DEBUG2: Found IP '192.168.205.1/27' matches site 'xyz-Strasse' prefix '192.168.205.0/27'
2025-03-12 07:24:29,204 - DEBUG: Current interface 'vNIC 6 (xyz-VLAN-2047u2050-2059Trunk-FIREWALL) (pf31)' for IP '192.168.205.1/27' and this one 'vNIC 6 (xyz-VLAN-2047u2050-2059Trunk-FIREWALL) (pf32)' are both enabled. The virtual machine will be checked later again to see if current interface status or association has changed
2025-03-12 07:24:34,658 - DEBUG2: Trying to find prefix for IP: 192.168.205.1/27
2025-03-12 07:24:34,658 - DEBUG2: Found IP '192.168.205.1/27' matches site 'xyz-Strasse' prefix '192.168.205.0/27'
2025-03-12 07:24:34,665 - WARNING: Current interface 'vNIC 6 (xyz-VLAN-2047u2050-2059Trunk-FIREWALL) (pf31)' for IP '192.168.205.1/27' and this one 'vNIC 6 (xyz-VLAN-2047u2050-2059Trunk-FIREWALL) (pf32)' are both enabled. IP assignment skipped because it is unclear which one is the correct one!
2025-03-12 07:24:35,843 - INFO: Updating NetBox 'IP address' object '192.168.205.1/27' with data: {'assigned_object_type': 'virtualization.vminterface', 'assigned_object_id': 64}
2025-03-12 07:24:35,844 - DEBUG2: Sending PATCH to 'http://172.19.40.81:80/api/ipam/ip-addresses/920/' with data 'b'{"assigned_object_type": "virtualization.vminterface", "assigned_object_id": 64}''.

Is there any way to keep netbox-sync from changing these assignements?

Cheers Io

ionoci avatar Mar 12 '25 06:03 ionoci

Hi,

Looking at it, I would suggest following: If the found IP is a FHRPgroup assigned, then it should be possible to assign this IP to multiple interfaces. In this case NetBox should not complain about it. Would of course on first synchronizations, where this info is not available, result in the same error. Then assigning this address to a vhrp group should stop the error messages. Will test this behavior.

bb-Ricardo avatar Mar 13 '25 21:03 bb-Ricardo

Hi @bb-Ricardo , I tried different ways with FHRPgroup assigend IP / Interfaces, but netbox-sync always pulls the IP back to the VM-Interface. May I assist in debuging? I'm not yet fit in python to check the code, but I may try to learn it. Cheers Io

ionoci avatar Apr 17 '25 09:04 ionoci

Sorry, just wanted to let you know that I have been busy lately and therefore had not much time looking into this issue. It's still on my todo list.

bb-Ricardo avatar May 09 '25 11:05 bb-Ricardo

👍 thanks for careing for this project.

ionoci avatar May 14 '25 04:05 ionoci

Is there a workaround without excluding the entire VM?

marvinwankersteen avatar Jul 09 '25 15:07 marvinwankersteen

please read: https://github.com/bb-Ricardo/netbox-sync/issues/474

bb-Ricardo avatar Jul 23 '25 21:07 bb-Ricardo