github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/docs/job-specification/hcl2/functions/ipnet/cidrnetmask.mdx (about)

     1  ---
     2  layout: docs
     3  page_title: cidrnetmask - Functions - Configuration Language
     4  description: |-
     5    The cidrnetmask function converts an IPv4 address prefix given in CIDR
     6    notation into a subnet mask address.
     7  ---
     8  
     9  # `cidrnetmask` Function
    10  
    11  `cidrnetmask` converts an IPv4 address prefix given in CIDR notation into
    12  a subnet mask address.
    13  
    14  ```hcl
    15  cidrnetmask(prefix)
    16  ```
    17  
    18  `prefix` must be given in IPv4 CIDR notation, as defined in
    19  [RFC 4632 section 3.1](https://tools.ietf.org/html/rfc4632#section-3.1).
    20  
    21  The result is a subnet address formatted in the conventional dotted-decimal
    22  IPv4 address syntax, as expected by some software.
    23  
    24  CIDR notation is the only valid notation for IPv6 addresses, so `cidrnetmask`
    25  produces an error if given an IPv6 address.
    26  
    27  ## Examples
    28  
    29  ```shell-session
    30  > cidrnetmask("172.16.0.0/12")
    31  255.240.0.0
    32  ```