ipv4_is_in_range()

Learn how to use the ipv4_is_in_range() function to check if the IPv4 string address is in the IPv4-prefix notation range.

Checks if IPv4 string address is in IPv4-prefix notation range.

Syntax

ipv4_is_in_range(Ipv4Address,Ipv4Range)

Parameters

NameTypeRequiredDescription
Ipv4Addressstring✔️An expression representing an IPv4 address.
Ipv4Rangestring✔️An IPv4 range or list of IPv4 ranges written with IP-prefix notation.

Returns

  • true: If the long representation of the first IPv4 string argument is in range of the second IPv4 string argument.
  • false: Otherwise.
  • null: If conversion for one of the two IPv4 strings wasn’t successful.

Example

datatable(ip_address:string, ip_range:string)
[
 '192.168.1.1',    '192.168.1.1',       // Equal IPs
 '192.168.1.1',    '192.168.1.255/24',  // 24 bit IP-prefix is used for comparison
]
| extend result = ipv4_is_in_range(ip_address, ip_range)

Output

ip_addressip_rangeresult
192.168.1.1192.168.1.1true
192.168.1.1192.168.1.255/24true