API Filter to pull a CIDR block of IPs or match in first few octets #17080
Unanswered
bradbendy
asked this question in
Help Wanted!
Replies: 1 comment 1 reply
-
I think what you are looking for is the
Source references here and here. In the Django ORM, you'd use:
(example in this custom script) Note that neither of these depend on an actual Prefix object existing in the database. It's just filtering on IP addresses which sit within a particular CIDR block. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I've looked everywhere and can't find anything on this. I want to pull all the IP addresses in say a single /24. I don't know of a filter to do this one.
I do see this in another post: https://github.com/netbox-community/netbox/blob/v3.1.6/netbox/ipam/filtersets.py#L589-L593
But when I add address__istartwith=x.y.z i get no difference in results. I also tried address__net_in=x.y.z.0/24 for example and same thing.
I was testing with netbox.domain.com/api/ipam/ip-addresses/?address__net_in= for exmaple
Am I missing something?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions