Attach already-existing IP address object to device #617

Closed
opened 2025-12-29 16:23:53 +01:00 by adam · 5 comments
Owner

Originally created by @candlerb on GitHub (Jan 9, 2017).

To demonstrate (netbox 1.8.1):

  • Create a standalone IP address 1.2.3.4/32
  • Create a device with an interface
  • Under the device, select "Assign IP address"
  • Enter 1.2.3.4/32

You are then left with a duplicate IP address - although it's not actually shown as a duplicate until you click on the IP address to go to /ipam/ip-addresses/<N>/. Then it shows the other one as a duplicate, which you have to select then delete.

You can avoid this problem by going in the opposite direction (go to the IP Address and then assign it to a Device). However it would be nice to do it from the Device screen; or at least when adding an address at the Device screen, get a warning that this is a duplicate address (and whether or not it's assigned to another Device)

Here's the usage case. You take your existing dumb IPAM or spreadsheet, and import all the IP address assignments into NetBox (many of which may be VMs, so are not on physical devices). Then you go back through it, creating devices and assigning the correct IP addresses to them as you go.

Originally created by @candlerb on GitHub (Jan 9, 2017). To demonstrate (netbox 1.8.1): * Create a standalone IP address 1.2.3.4/32 * Create a device with an interface * Under the device, select "Assign IP address" * Enter 1.2.3.4/32 You are then left with a duplicate IP address - although it's not actually shown as a duplicate until you click on the IP address to go to `/ipam/ip-addresses/<N>/`. Then it shows the other one as a duplicate, which you have to select then delete. You can avoid this problem by going in the opposite direction (go to the IP Address and then assign it to a Device). However it would be nice to do it from the Device screen; or at least when adding an address at the Device screen, get a warning that this is a duplicate address (and whether or not it's assigned to another Device) Here's the usage case. You take your existing dumb IPAM or spreadsheet, and import all the IP address assignments into NetBox (many of which may be VMs, so are not on physical devices). Then you go back through it, creating devices and assigning the correct IP addresses to them as you go.
adam added the type: feature label 2025-12-29 16:23:53 +01:00
adam closed this issue 2025-12-29 16:23:53 +01:00
Author
Owner

@Armadill0 commented on GitHub (Jan 11, 2017):

I can confirm, that the IP is being duplicated.

@Armadill0 commented on GitHub (Jan 11, 2017): I can confirm, that the IP is being duplicated.
Author
Owner

@candlerb commented on GitHub (Jan 16, 2017):

Note: the same issue also applies to prefixes and VLANs

  • Create prefix 192.168.10.0/24
  • Go to VLAN 10
  • Select "+ Add a prefix"
  • Enter 192.168.10.0/24

This does then jump to the prefix view, which shows you immediately that there is a duplicate which clashes with this prefix.

Again, it works fine if you do it the other way round: go to the prefix, then select the site and VLAN you want to associate it with.

@candlerb commented on GitHub (Jan 16, 2017): Note: the same issue also applies to prefixes and VLANs * Create prefix 192.168.10.0/24 * Go to VLAN 10 * Select "+ Add a prefix" * Enter 192.168.10.0/24 This does then jump to the prefix view, which shows you immediately that there is a duplicate which clashes with this prefix. Again, it works fine if you do it the other way round: go to the prefix, then select the site and VLAN you want to associate it with.
Author
Owner

@candlerb commented on GitHub (Jan 16, 2017):

So far I was testing with ENFORCE_GLOBAL_UNIQUE=False (default)

If I set this to True and restart supervisord/gunicorn:

  • Adding an address to an interface, where the address already exists, is rejected

    image

    (so here would be a good point to offer to attach the interface to this existing address)

  • Adding a Prefix to a VLAN is still permitted, and results in a duplicate prefix

    image

@candlerb commented on GitHub (Jan 16, 2017): So far I was testing with `ENFORCE_GLOBAL_UNIQUE=False` (default) If I set this to True and restart supervisord/gunicorn: * Adding an address to an interface, where the address already exists, is rejected ![image](https://cloud.githubusercontent.com/assets/44789/21996480/56a50f22-dc22-11e6-9e44-10032a7025e6.png) (so here would be a good point to offer to attach the interface to this existing address) * Adding a Prefix to a VLAN is still permitted, and results in a duplicate prefix ![image](https://cloud.githubusercontent.com/assets/44789/21996572/d48ebcc6-dc22-11e6-9170-0231bab01127.png)
Author
Owner

@candlerb commented on GitHub (Jan 16, 2017):

It turns out that adding duplicate prefixes is allowed even when not assigning them to VLANs, so I've opened #802 for that.

@candlerb commented on GitHub (Jan 16, 2017): It turns out that adding duplicate prefixes is allowed even when not assigning them to VLANs, so I've opened #802 for that.
Author
Owner

@jeremystretch commented on GitHub (May 9, 2017):

Assigning an IP to an interface was implemented in #1001. Please note that the behavior described above concerning the creation of duplicate objects using the prescribed workflow is valid and intentional.

@jeremystretch commented on GitHub (May 9, 2017): Assigning an IP to an interface was implemented in #1001. Please note that the behavior described above concerning the creation of duplicate objects using the prescribed workflow is valid and intentional.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#617