Enhancement #1200
open
Search for IP addresses included in a subnet
Added by Jonathan CLARKE about 13 years ago.
Updated over 2 years ago.
Category:
Web - Nodes & inventories
Description
We must be able to clearly match nodes that have an IP in a given subnet, eg 192.168.0.0/24
- Target version changed from 9 to 10
First version : an IP with /8, /16, /24 or /32
- Target version changed from 10 to 18
Set in 2.4, perhaps it will be needed soon.
- Target version changed from 18 to 24
- Category set to Web - Nodes & inventories
- Target version changed from 24 to 18
- Target version changed from 18 to Ideas (not version specific)
Hi,
I just ran into this.
Currently you need to make heavy abuse of regex matches to implement subnet calculations.
It is feasible for dealing with small numbers of networks but i.e. when considering doing this for 1000 or 10000 subnets it gets really awkward and it's very hard to automatically generate.
Now, to make it worse:
We've just established it's possible to add them using regex. But honestly: It's pretty impossible to maintain and thus it should really be a builtin comparism.
Please keep in mind ipv6 on this one since it'll be even more needed. I don't think we want to assign a million+ ip range for any single dmz network...
[duplicated with other comments]
Regex trick¶
Example for Regex usage
Mapping a subnet to regex¶
Subnet: 192.168.10.0/25
Regex: 192.168.10.([0-9]{3} | 1[01][0-9] | 12[0-6])
Make sure you don't forget the mask when naming your group, i.e.
NET-192_168_10_P25
(P for Prefix)
The correct regex is:
192\.168\.10\.([0-9]{1,2}|1[01][0-9]|12[0-6])
It will matches IPs 192.168.10.{0-126}
You can build any integer matching with the above decomposition trick ( [0-9] or [0-9][0-9] or 11[0-9] etc). It's "just" über fastidious.
You can check the regex with http://www.regexplanet.com/advanced/java/index.html for example.
- Tracker changed from User story to Enhancement
Also available in: Atom
PDF