network()

Returns the network address value to the given IPv4/IPv6 address and CIDR.

Syntax

network(IP_ADDR, CIDR)
Required Parameters
IP_ADDR
String or IP address of IPv4 and IPv6. IPv6 addresses are case-insensitive.
CIDR
CIDR value (integer). The CIDR value range is from 0 to 32 for IPv4 or 0 to 128 for IPv6.

Usage

json "{}" 
| eval network=network(null, 32)
  => null

json "{}" 
| eval network=network("192.0.2.128", 24)
  => 192.0.2.0

json "{}" 
| eval network=network("192.0.2.128", 28)
  => 192.0.2.128

json "{}" 
| eval network=network(ip(-1073741184), 28)
  => 192.0.2.128

json "{}" 
| eval network=network("21DA:00D3:0000:2F3B:02AA:00FF:FE28:9C5A", 96)
  => 21da:d3:0:2f3b:2aa:ff:0:0