Validation of IP Addresses when of type network or broadcast #6313

Closed
opened 2025-12-29 19:39:15 +01:00 by adam · 5 comments
Owner

Originally created by @falz on GitHub (Apr 7, 2022).

Originally assigned to: @decoupca on GitHub.

NetBox version

v3.1.11

Feature type

New functionality

Proposed functionality

One of the many ways we use netbox is to assign IP addresses to device interfaces, which are used to push config changes to device.

Currently, one can add any ip address, including the network or broadcast address, to an interface. This is not a valid config from any devices standpoint. There are some obvious exceptions to this:

  • /31 - rfc3021
  • /32 - In our case, we set these to Role Loopback
  • /127 - rfc6164

Are there other use cases other than above where an IP object on a broadcast or network address should be added?

I would propose that some sort of validation happens when 'invalid' IP addresses are added to netbox. It's not entirely clear what the best validation here is but a few possibilities would be:

  • don't accept the IP
  • throw a big scary warning, but accept the IP

One could also consider a config knob to disable this sanity check and revert to current behavour.

It sounds like there may be a way to handle this via a custom validator, but it seems to be enough of a common issue that it seems worth discussion built in functionality.

There is some discussion about this in this slack thread.

Use case

Should help with user friendliness of end users using netbox, preventing humans clumsy entering invalid data.

Database changes

No response

External dependencies

No response

Originally created by @falz on GitHub (Apr 7, 2022). Originally assigned to: @decoupca on GitHub. ### NetBox version v3.1.11 ### Feature type New functionality ### Proposed functionality One of the many ways we use netbox is to assign IP addresses to device interfaces, which are used to push config changes to device. Currently, one can add any ip address, including the network or broadcast address, to an interface. This is not a valid config from any devices standpoint. There are some obvious exceptions to this: * /31 - rfc3021 * /32 - In our case, we set these to Role Loopback * /127 - rfc6164 Are there other use cases other than above where an IP object on a broadcast or network address should be added? I would propose that some sort of validation happens when 'invalid' IP addresses are added to netbox. It's not entirely clear what the best validation here is but a few possibilities would be: * don't accept the IP * throw a big scary warning, but accept the IP One could also consider a config knob to disable this sanity check and revert to current behavour. It sounds like there may be a way to handle this via a custom validator, but it seems to be enough of a common issue that it seems worth discussion built in functionality. There is some discussion about this in [this slack thread.](https://netdev-community.slack.com/archives/C01P0FRSXRV/p1649339405458799) ### Use case Should help with user friendliness of end users using netbox, preventing humans clumsy entering invalid data. ### Database changes _No response_ ### External dependencies _No response_
adam added the status: acceptedtype: feature labels 2025-12-29 19:39:15 +01:00
adam closed this issue 2025-12-29 19:39:16 +01:00
Author
Owner

@jeremystretch commented on GitHub (Apr 7, 2022):

Are there other use cases other than above where an IP object on a broadcast or network address should be added?

I can't think of any, but in case there are, we could optionally apply this validation only to IP addresses which have been assigned to an object (e.g. interface). That I think would be reasonable regardless.

@jeremystretch commented on GitHub (Apr 7, 2022): > Are there other use cases other than above where an IP object on a broadcast or network address should be added? I can't think of any, but in case there are, we could optionally apply this validation only to IP addresses which have been assigned to an object (e.g. interface). That I think would be reasonable regardless.
Author
Owner

@github-actions[bot] commented on GitHub (Jul 24, 2022):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.

@github-actions[bot] commented on GitHub (Jul 24, 2022): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. **Do not** attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Author
Owner

@DanSheps commented on GitHub (Aug 2, 2022):

I think this would be best blocked until we get #7845 implemented

@DanSheps commented on GitHub (Aug 2, 2022): I think this would be best blocked until we get #7845 implemented
Author
Owner

@jeremystretch commented on GitHub (Aug 16, 2022):

@DanSheps I don't think this has any dependency on #7845, since the IP address object has all the necessary information locally.

@jeremystretch commented on GitHub (Aug 16, 2022): @DanSheps I don't think this has any dependency on #7845, since the IP address object has all the necessary information locally.
Author
Owner

@decoupca commented on GitHub (May 15, 2023):

I'll take this one

@decoupca commented on GitHub (May 15, 2023): I'll take this one
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6313