Unable to assign IP to device without an interface (no error) #1215

Closed
opened 2025-12-29 16:30:06 +01:00 by adam · 9 comments
Owner

Originally created by @Gelob on GitHub (Sep 6, 2017).

Issue type

[ X ] Bug report

Environment

  • Python version: Python 2.7.5
  • NetBox version: 2.1.4

Description

When trying to assign an IP address to a device (ie /ipam/ip-addresses/1195/edit/) I select a a Site, Rack, and Device, but leave Interface blank (-----) and hit Update. I don't get any error and I get taken back to the IP address view screen, but the IP is not assigned.

I assume I must select an interface but it is not throwing an error.

Originally created by @Gelob on GitHub (Sep 6, 2017). ### Issue type [ X ] Bug report <!-- Reporting unexpected or erroneous behavior --> ### Environment * Python version: Python 2.7.5 * NetBox version: 2.1.4 ### Description When trying to assign an IP address to a device (ie /ipam/ip-addresses/1195/edit/) I select a a Site, Rack, and Device, but leave Interface blank (-----) and hit Update. I don't get any error and I get taken back to the IP address view screen, but the IP is not assigned. I assume I must select an interface but it is not throwing an error.
adam closed this issue 2025-12-29 16:30:06 +01:00
Author
Owner

@RyanBreaker commented on GitHub (Sep 6, 2017):

This appears to be intended behavior as an IP cannot be assigned directly to a device and must instead be assigned to an interface, although for usability it may be a good idea to at least add an informational message about that to the section.

If you need to add an IP to a device separate from a physical interface, you can add a Virtual form-factor interface to it and assign the IP to that, much like a Loopback, and then check the box for it to be the device's Primary IP as well if you wish.

@RyanBreaker commented on GitHub (Sep 6, 2017): This appears to be intended behavior as an IP cannot be assigned directly to a device and must instead be assigned to an interface, although for usability it may be a good idea to at least add an informational message about that to the section. If you need to add an IP to a device separate from a physical interface, you can add a Virtual form-factor interface to it and assign the IP to that, much like a Loopback, and then check the box for it to be the device's Primary IP as well if you wish.
Author
Owner

@Gelob commented on GitHub (Sep 6, 2017):

@RyanBreaker Netbox should throw an error (and i think it used to in the past) but it is not doing that now. It accepts the POST request but does nothing.

@Gelob commented on GitHub (Sep 6, 2017): @RyanBreaker Netbox should throw an error (and i think it used to in the past) but it is not doing that now. It accepts the POST request but does nothing.
Author
Owner

@jeremystretch commented on GitHub (Sep 11, 2017):

It's not throwing an error because the interface field is left blank. The other fields (site, rack, device) are just helpers, so they don't trigger an error. I suppose we could add some validation logic to check for the submission of a device without an interface, but is it really necessary?

@jeremystretch commented on GitHub (Sep 11, 2017): It's not throwing an error because the interface field is left blank. The other fields (site, rack, device) are just helpers, so they don't trigger an error. I suppose we could add some validation logic to check for the submission of a device without an interface, but is it really necessary?
Author
Owner

@Gelob commented on GitHub (Sep 11, 2017):

@jeremystretch i think so because when I hit update, netbox acts like it accepts my data and inserts it into the database but it doesn't.

@Gelob commented on GitHub (Sep 11, 2017): @jeremystretch i think so because when I hit update, netbox acts like it accepts my data and inserts it into the database but it doesn't.
Author
Owner

@jeremystretch commented on GitHub (Sep 11, 2017):

@Gelob It does though. The data you're sending it is interface: None, and that's what's being stored in the database. If an IP address was previously assigned to an interface, and you deselect that interface, the assignment will be removed.

@jeremystretch commented on GitHub (Sep 11, 2017): @Gelob It does though. The data you're sending it is `interface: None`, and that's what's being stored in the database. If an IP address was previously assigned to an interface, and you deselect that interface, the assignment will be removed.
Author
Owner

@Gelob commented on GitHub (Sep 13, 2017):

@jeremystretch but when I view the IP address the device doesn't show up.

If you take an IP address thats assigned to a device and an interface, edit it, and remove the interface, then view the IP address you'll see that the IP no longer is associated with that device at all.

@Gelob commented on GitHub (Sep 13, 2017): @jeremystretch but when I view the IP address the device doesn't show up. If you take an IP address thats assigned to a device and an interface, edit it, and remove the interface, then view the IP address you'll see that the IP no longer is associated with that device at all.
Author
Owner

@jeremystretch commented on GitHub (Sep 13, 2017):

@Gelob Yes, that's intended behavior. IPs must be assigned to interfaces.

@jeremystretch commented on GitHub (Sep 13, 2017): @Gelob Yes, that's intended behavior. IPs must be assigned to interfaces.
Author
Owner

@Gelob commented on GitHub (Sep 14, 2017):

OK, so we are on the same page :). It would seem logical to throw an error if a required field is left blank instead of netbox confusing the end user and accepting the input but not updating the IP properly.

@Gelob commented on GitHub (Sep 14, 2017): OK, so we are on the same page :). It would seem logical to throw an error if a required field is left blank instead of netbox confusing the end user and accepting the input but not updating the IP properly.
Author
Owner

@jeremystretch commented on GitHub (Sep 19, 2017):

I don't think we need an error for this. Maybe it's something we can address at a future iteration of the form widgets but right now I don't want to add extraneous validation logic to yield errors just because one field is set when another isn't.

@jeremystretch commented on GitHub (Sep 19, 2017): I don't think we need an error for this. Maybe it's something we can address at a future iteration of the form widgets but right now I don't want to add extraneous validation logic to yield errors just because one field is set when another isn't.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1215