Unable to create SDN subnet with netbox integration if bigger prefix pool already exists

lumarel

New Member
Feb 6, 2025
9
4
3
I was looking into an issue where PVE presents me this error when trying to create a SDN subnet:
create sdn subnet object failed: prefix 10.1.50.0/24 already exists in netbox at /usr/share/perl5/PVE/Network/SDN/Ipams/NetboxPlugin.pm line 80. (500)

The thing is there is a bigger prefix that includes the to be created prefix, and due to that it's unwilling.
In this case 10.1.0.0/16, but that's by design in netbox that you can nest prefixes.

As far as I could find out, this comes from this line:
https://github.com/proxmox/pve-network/blob/master/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm#L405

Tbh this should be ?prefix= instead of ?q= to only match the exact prefix.

Tested this with PVE 8.4.1 and Netbox 4.2.5

Cheers, Lukas
 
Hello,
thanks for your investigation.

I have not enough clue about the code.
But - its more then simple "match the exact prefix."
https://netboxlabs.com/docs/netbox/models/ipam/prefix/
Hi there!

Do you mean the same prefix in multiple VRFs part? Yes another consideration.
Or did I miss even more?

The thing is as far as I understand the current implementation it wants to check if the prefix already exists and if yes it should fail, but instead if any related prefix exists it will fail (i.e. prefix in other prefix)

At least from the PVE standpoint the check is all about if it will be able to create the prefix/ipaddress object.
 
Hi there!
Do you mean the same prefix in multiple VRFs part? Yes another consideration.
Or did I miss even more?

The thing is as far as I understand the current implementation it wants to check if the prefix already exists and if yes it should fail, but instead if any related prefix exists it will fail (i.e. prefix in other prefix)

At least from the PVE standpoint the check is all about if it will be able to create the prefix/ipaddress object.
yes .. the rabbithole: https://forum.proxmox.com/threads/s...-ip-10-0-0-1-already-exist.164102/post-777211
 
I was looking into an issue where PVE presents me this error when trying to create a SDN subnet:
create sdn subnet object failed: prefix 10.1.50.0/24 already exists in netbox at /usr/share/perl5/PVE/Network/SDN/Ipams/NetboxPlugin.pm line 80. (500)

The thing is there is a bigger prefix that includes the to be created prefix, and due to that it's unwilling.
In this case 10.1.0.0/16, but that's by design in netbox that you can nest prefixes.

As far as I could find out, this comes from this line:
https://github.com/proxmox/pve-network/blob/master/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm#L405

Tbh this should be ?prefix= instead of ?q= to only match the exact prefix.

Tested this with PVE 8.4.1 and Netbox 4.2.5

Cheers, Lukas
Hi, I faced with same issue

PVE ver 9.0.6, Netbox 4.4.1
I've changed in /usr/share/perl5/PVE/Network/SDN/Ipams/NetboxPlugin.pm line 430
Perl:
my $result = eval { netbox_api_request($config, "GET", "/ipam/prefixes/?prefix=$ip") };

but NODE still trying to make request with key q=

How to apply this change without reboot the node ?
 
Last edited:
And, in my case, I have few Upper containers for my specific prefix

for example
I would like to create prefix 10.10.10.0/24
But I have special "container" for special purposes in Netbox
container - 10.10.0.0/16 - for Proxmox VM/CT

And when PVE is trying to extract prefix with ?q=$ip , Netbox API is returning all Upper containers for specific IP/Prefix
 
Last edited:
After changes, restart services
Bash:
systemctl restart pveproxy
systemctl restart pvedaemon

and now, I can create network
 
  • Like
Reactions: lumarel