Replies: 6 comments 11 replies
-
Have you ever configure a network interface without inputing the subnet mask? That's why. |
Beta Was this translation helpful? Give feedback.
-
You can still record a /32 or /128 for the "but sometimes" cases, the most common cases are going to need the netmask when using the IP in a config template, so having it available without needing a second API call to find the Active Prefix containing the IP is helpful. Better to have and not need than need and not have. You can still query for an IP without the netmask as well, at least for IPv4, to find the right record from tools which may not already know the netmask.
—
Mark Tinberg ***@***.***>
Division of Information Technology-Network Services
University of Wisconsin-Madison
…________________________________
From: Brian Candler ***@***.***>
Sent: Wednesday, February 23, 2022 3:21 PM
To: netbox-community/netbox ***@***.***>
Cc: Subscribed ***@***.***>
Subject: Re: [netbox-community/netbox] Why are subnet masks required for IP Addresses? (Discussion #8731)
I have instances in EC2. They have public IPs without a netmask.
—
Reply to this email directly, view it on GitHub<#8731 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAS7UMZS5ZEH4ADUWQBLQZLU4VFUHANCNFSM5PFQCISQ>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
You can record IP addresses without a containing Prefix record though, so would you require a Prefix to record an IP or fail to return netmasks for IPs that exist without a Prefix? And how does that work within the Django ORM?
—
Mark Tinberg ***@***.***>
Division of Information Technology-Network Services
University of Wisconsin-Madison
…________________________________
From: Kit ***@***.***>
Sent: Wednesday, February 23, 2022 3:52 PM
To: netbox-community/netbox ***@***.***>
Cc: Mark Tinberg ***@***.***>; Comment ***@***.***>
Subject: Re: [netbox-community/netbox] Why are subnet masks required for IP Addresses? (Discussion #8731)
Ya this was the idea that came to mind of why it was implemented. Just felt like it was redundant documentation when prefixes existed.
I can kind of see the loop issue where when using an API call to grab an IP Address. How best to package an answer to an API call trying to collect a Child Resource but include the Parent info. Always include the smallest prefix? Do you allow a call to a larger prefix?
I kind of want to stab at solving this because I hate filling in redundant information that much!
—
Reply to this email directly, view it on GitHub<#8731 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAS7UM53LGW5VNN2AAAK2MDU4VJIBANCNFSM5PFQCISQ>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
I would be nice if this could be inherited from the Prefix, and I wonder if a new logic could be tested out as a plugin, before attempting to change something that would impact everyone.
Eg. If the mask on a new IPAddress object is supplied then use it but if the mask is not submitted on a new IPAddress object then try to look up the containing Prefix and use that mask, otherwise /32 or /128 depending on the address family. That shouldn't break existing tools which already include the netmask, and it should keep the same db schema (comment in fields.py says it's a PostgreSQL INET column and is returned as a Python netaddr.IPNetwork object IIUC)
I'm not sure if this logic would be added to fields.py or somewhere else, I'd be concerned about adding more db lookups for data coming out of the db or interfering with the exception handling when trying to validate the submitted value, since we'd start expecting incomplete values and still need to raise an exception if our attempt to flesh them out fails. We may only want this to modify incomplete values going into the db and not read from the db, but I don't know enough about Django or Python to know whether adding a new to_python method in IPAddressField is the right approach or totally the wrong way to attempt this.
—
Mark Tinberg ***@***.***>
Division of Information Technology-Network Services
University of Wisconsin-Madison
…________________________________
From: Brian Candler ***@***.***>
Sent: Thursday, February 24, 2022 2:35 AM
To: netbox-community/netbox ***@***.***>
Cc: Mark Tinberg ***@***.***>; Comment ***@***.***>
Subject: Re: [netbox-community/netbox] Why are subnet masks required for IP Addresses? (Discussion #8731)
It's also a pain in 'real' networks. A source of truth shouldn't duplicate data, because whenever you have manual duplication of data, there will always be inconsistencies.
For example, we have a bunch of networks with public IPs that are /26; however people who are assigning IP address often enter /24 because Netbox forces them to enter something, and that's what they learned with private IPs. So either I need to run reports<https://github.com/netbox-community/reports/blob/master/reports/ipam-reports/ip-check-prefix.py> periodically to highlight all the inconsistencies, and fix them by hand (in order for the data to be "clean"); or I just accept that the prefix lengths will be wrong, which looks bad but doesn't otherwise break anything for the way we use Netbox.
Netbox has recently gained custom validation capabilities, so these days it might be possible for me to hook something into that. However I'd really prefer the data to be modelled in a non-duplicative way: one prefix, many IP addresses. I don't buy the argument that "this is inefficient": that's premature optimisation, and IMO good data design comes ahead of shaving a microsecond off query times.
However I lost this argument with @jeremystretch<https://github.com/jeremystretch> years ago. For a while I did run a local modification to Netbox which let users enter IPs without prefix, setting them to /32 or /128 automatically. But there are big advantages to sticking with "stock" Netbox when it comes to applying updates.
—
Reply to this email directly, view it on GitHub<#8731 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAS7UM55YR5LTV3BNSEOIVTU4XUTJANCNFSM5PFQCISQ>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Responding in-line
I believe you're saying that the data model is unchanged, i.e. each IP address still has a prefix length. If so, can you clarify your proposal in the following ways:
Yes, don't change the column type or return value for the address of an IPAddress object as that would be disruptive to existing code and expectations about the contents of this value.
Should it be optional that you enter a prefix length for an IP address, or that you never provide one and it's always auto-generated?
Optional, so that existing scripts and operational procedures that expect to set and get addresses in CIDR notation still work
If entering a prefix length is optional, but you enter a prefix length which does not match the nearest enclosing prefix, what should happen? Validation error; silently correct it; keep it but flag a warning message; something else?
It should accept the value as it would today, no exception, no correction. You can have a validation report that runs later to catch errors, or use the custom validator feature to enforce compliance, but Netbox shouldn't override what the Network Engineer inputs, unless it's just a totally invalid input (like a string in a number field).
If entering a prefix length is optional, under what circumstances is it permitted to enter an IP address with /32 or /128 as prefix length? (e.g. the enclosing prefix is marked as "is_pool"; the IP address itself is marked with a role like Loopback / VIP / VRRP etc; something else; never?)
It's always valid to enter as /32 or /128 and I don't think there should be enforcement of business rules like that unless the Netbox Admin / Network Engineer opt-in to it.
When you save (modify) and IP address object, is its prefix length checked again the enclosing prefix? What happens here if it doesn't match?
I would not interfere with the user putting whatever prefix length they want and only guess when it's not provided. There may be a case where an _existing_ IPAddress object is modified and the new address field is not fully populated, then you'd have to decide wither to auto-generate the netmask, use the existing one from the record or throw an exception (or none of these if the address field is not modifiable without creating a new record ID, I didn't take time to test this before replying)
When you modify and/or delete a prefix, does this automatically update all child IP addresses within it?
No, I wouldn't recommend that, but an audit report could offer to do this if desired. I wouldn't want surprising behavior for an existing Netbox user, making changes like this would catch someone out and break their workflow.
If you are never allowed to provide the prefix length, but you enter an IP address which has no enclosing prefix, what should happen? Set it to /32 or /128?
While as I stated I wouldn't forbid CIDR notation, yes I'd set to /32 or /128 if there were no enclosing prefix, although another wrinkle that just came to mind is if someone creates a 0/0 or 10/8 or whatever Prefix, would that be the "enclosing" prefix and create a bunch of IPAddress records with /8 netmasks, which was probably not what the Netbox User wanted..
—
Mark Tinberg ***@***.***>
Division of Information Technology-Network Services
University of Wisconsin-Madison
Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Any idea what happened with this one? The concept seems quite interesting. |
Beta Was this translation helpful? Give feedback.
-
I am curious as to why cidr mask is required for IP Addresses. I understand Prefix's and maybe ranges.
However, why for singular addresses that may be assigned to interfaces or resources?
Beta Was this translation helpful? Give feedback.
All reactions