Prefix search almost useless #616

Closed
opened 2025-12-29 16:23:53 +01:00 by adam · 1 comment
Owner

Originally created by @Armadill0 on GitHub (Jan 10, 2017).

Problem:
We just filled Netbox 1.8.1 with many new Prefixes. Here we have a few examples:

  • 10.4.0.0/27
  • 10.4.0.32/27
  • 10.175.16.0/24
  • 10.175.18.0/24

and so on...

Results:

  • When I'm now entering "10" to the prefix search I'm only getting a prefix of one of our public IP ranges, which is something like "109.XXX...".
  • If I'm searching for "10.4" I only get "10.4.0.0/27" as a result.
  • "10.175.16" results in "10.175.16.0/24"
  • "10.175.18" results in "10.175.18.0/24"

There is no way to get all "10.*" prefixes neither from the search nor via the "Search within" filter.

Conclusion:
It seems like the search text is being converted to binary and filled with zeros to search for the prefix itself. Other search fields are searched in a wildcard behaviour.
My theory is that the search uses the Postgres Network address types which makes the search for prefixes nearly useless.

Request:
Please extend the prefix search to allow a string search in the prefixes.

MAC addresses also affected:
It seems we have a similar problem with the mac address filter. Maybe this can be fixed, too. E.g. there are no results for "00" although there should be multiple results starting with "00". 😄

Originally created by @Armadill0 on GitHub (Jan 10, 2017). **Problem:** We just filled Netbox 1.8.1 with many new Prefixes. Here we have a few examples: * 10.4.0.0/27 * 10.4.0.32/27 * 10.175.16.0/24 * 10.175.18.0/24 and so on... **Results:** * When I'm now entering "10" to the prefix search I'm only getting a prefix of one of our public IP ranges, which is something like "109.XXX...". * If I'm searching for "10.4" I only get "10.4.0.0/27" as a result. * "10.175.16" results in "10.175.16.0/24" * "10.175.18" results in "10.175.18.0/24" There is no way to get all "10.*" prefixes neither from the search nor via the "Search within" filter. **Conclusion:** It seems like the search text is being converted to binary and filled with zeros to search for the prefix itself. Other search fields are searched in a wildcard behaviour. My theory is that the search uses the Postgres Network address types which makes the search for prefixes nearly useless. **Request:** Please extend the prefix search to allow a string search in the prefixes. **MAC addresses also affected:** It seems we have a similar problem with the mac address filter. Maybe this can be fixed, too. E.g. there are no results for "00" although there should be multiple results starting with "00". :smile:
adam closed this issue 2025-12-29 16:23:53 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jan 10, 2017):

NetBox prefix and IP search don't support wildcards. The value you enter is converted to an IP address or prefix. So for example, "10.4" becomes "10.4.0.0," which yields the prefix 10.4.0.0/27. This is the preferred approach over wildcards, because you can enter any IP address and NetBox will return all the prefixes which contain that IP.

This is particularly useful when prefix lengths don't fall on CIDR boundaries. For example, suppose you have the IP address 192.168.123.10 inside the prefix 192.168.122.0/23. Searching for 192.168.123.* wouldn't find the prefix, and 192.168.* would be far too broad.

There is no way to get all "10.*" prefixes neither from the search nor via the "Search within" filter.

Enter "10.0.0.0/8" to find all prefixes contained within.

It seems we have a similar problem with the mac address filter.

The MAC address filter accepts only a full MAC address, because we typically don't have a need to segment MAC addresses. (MAC addresses are not aggregatable.) Please open a separate issue for this request if you have a use case for it.

@jeremystretch commented on GitHub (Jan 10, 2017): NetBox prefix and IP search don't support wildcards. The value you enter is converted to an IP address or prefix. So for example, "10.4" becomes "10.4.0.0," which yields the prefix 10.4.0.0/27. This is the preferred approach over wildcards, because you can enter any IP address and NetBox will return all the prefixes which contain that IP. This is particularly useful when prefix lengths don't fall on CIDR boundaries. For example, suppose you have the IP address 192.168.123.10 inside the prefix 192.168.122.0/23. Searching for 192.168.123.* wouldn't find the prefix, and 192.168.* would be far too broad. > There is no way to get all "10.*" prefixes neither from the search nor via the "Search within" filter. Enter "10.0.0.0/8" to find all prefixes contained within. > It seems we have a similar problem with the mac address filter. The MAC address filter accepts only a full MAC address, because we typically don't have a need to segment MAC addresses. (MAC addresses are not aggregatable.) Please open a separate issue for this request if you have a use case for it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#616