Hi. i need to create two custom properties that one will give me the lan ip address and the other the wireless ip adreess.
i Use:
if ( exists true whose (if true then ( exists ip interfaces of network) else false) ) then addresses whose (it as string != “0.0.0.0”) of ip interfaces whose (not loopback of it) of network as string else nothing
this list me all the address but i need how to check ip’s started by example 10.168..
if i put this if ( exists true whose (if true then ( exists ip interfaces of network) else false) ) then addresses whose (it as string != “10.168.0.0”) of ip interfaces whose (not loopback of it) of network as string else nothing
i dont get anything if i put the 10.168.. as wildcard doesn’t work also.
If you’d like to filter the IP Addresses being returned to those that start with a specific string, you were on the right path by adjusting the whose section. Try something like:
if ( exists true whose (if true then ( exists ip interfaces of network) else false) ) then addresses whose (it as string != "0.0.0.0" AND it as string starts with "10.168.") of ip interfaces whose (not loopback of it) of network as string else nothing
if ( exists true whose (if true then ( exists ip interfaces of network) else false) ) then addresses whose (it as string != “0.0.0.0” AND it as string starts with “10.”) of ip interfaces whose (not loopback of it) of network as string else nothing
but i dont want to get multiple results in console i would like to exclude from that search some ranges like 10.224." and 10.254."
You can also leverage the whose clause to filter out results. For the specific ranges you mention above, something like the following might work:
if ( exists true whose (if true then ( exists ip interfaces of network) else false) ) then addresses whose (it as string != "0.0.0.0" AND it as string starts with "10." AND it as string does not start with "10.224." AND it as string does not start with "10.254.") of ip interfaces whose (not loopback of it) of network as string else nothing
That said, depending on the number of potential exclusions, there are perhaps better or more efficient ways of doing this.