Redigera

Dela via


ipv4_range_to_cidr_list()

Applies to: ✅ Microsoft FabricAzure Data ExplorerAzure MonitorMicrosoft Sentinel

Converts a IPv4 address range denoted by starting and ending IPv4 addresses to a list of IPv4 ranges in CIDR notation.

Syntax

ipv4_range_to_cidr_list(StartAddress , EndAddress )

Learn more about syntax conventions.

Parameters

Name Type Required Description
StartAddress string ✔️ An expression representing a starting IPv4 address of the range.
EndAddress string ✔️ An expression representing an ending IPv4 address of the range.

Returns

A dynamic array object containing the list of ranges in CIDR notation.

IP-prefix notation

IP-prefix notation (also known as CIDR notation) is a concise way of representing an IP address and its associated network mask. The format is <base IP>/<prefix length>, where the prefix length is the number of leading 1 bits in the netmask. The prefix length determines the range of IP addresses that belong to the network.

For IPv4, the prefix length is a number between 0 and 32. So the notation 192.168.2.0/24 represents the IP address 192.168.2.0 with a netmask of 255.255.255.0. This netmask has 24 leading 1 bits, or a prefix length of 24.

For IPv6, the prefix length is a number between 0 and 128. So the notation fe80::85d:e82c:9446:7994/120 represents the IP address fe80::85d:e82c:9446:7994 with a netmask of ffff:ffff:ffff:ffff:ffff:ffff:ffff:ff00. This netmask has 120 leading 1 bits, or a prefix length of 120.

Examples

print start_IP="1.1.128.0", end_IP="1.1.140.255"
 | project ipv4_range_list = ipv4_range_to_cidr_list(start_IP, end_IP)

Output

ipv4_range_list
["1.1.128.0/21", "1.1.136.0/22","1.1.140.0/24"]