-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove subnet mask from IP Addresses #14717
Comments
It's already possible to create an IP Address with no mask, and if you do this, Netbox automatically turns it into a /32 for display. Example from >>> ip = IPAddress(address='192.168.5.1')
>>> ip.save()
>>> IPAddress.objects.last()
<IPAddress: 192.168.5.1/32> The Postgres data is stored like this: netbox=> SELECT address FROM ipam_ipaddress ORDER BY id DESC LIMIT 2;
address
-----------------
192.168.5.1
10.37.163.37/24 Apparently the mask requirement is only here in the GUI form: netbox/netbox/ipam/formfields.py Lines 53 to 56 in c78a792
|
You have to call full_clean() on the object before saving, otherwise no validation is executed. |
@kkthxbye-code I don't think that's accurate. See my other question #14718. Anyway, in this example, full_clean does not make any difference, it still passes validation. |
Regardless, being able to do something in nbshell has no bearing on how netbox is designed and as such should not be used as arguments in feature requests. nbshell and custom scripts are "power user" features, and requires knowledge of django to use. |
this feels like it would be dependent on #7845 |
Which is a subnet mask, albeit likely not the correct one for the IP address. This discussion has run its course and we will not be making any changes. |
NetBox version
v3.7.0
Feature type
Change to existing functionality
Proposed functionality
Currently the subnet mask length is an attribute of each IP address. I think it would make more sense for this to be an attribute of the prefix instead. I propose these changes:
10.1.2.3
)Use case
The current model is redundant, and there is a risk that users enter the wrong mask length when creating a new IP Address, as described here: #8731 (reply in thread).
One way to avoid this risk is by instructing users to always use
/32
, which effectively makes that mask_length attribute useless, so in that case you would still need to refer to the IP Prefix to find it.Moving the mask length to be an attribute of the Prefix would reduce the operational burden for data entry, and it would align better with the single source of truth concept. As a general rule, all IP addresses under the same parent prefix should share the same same mask length. I can't think of any exceptions to that.
This would also make it easier on the eyes when looking at big lists of addresses
Database changes
My best guess, not knowing Netbox very well:
prefix_id
field toipam_ipaddress
External dependencies
none
The text was updated successfully, but these errors were encountered: