Variable as IP address

Parent Previous Next

Data variables are added to the templates in the format <VariableDelimiter><VariableName><VariableDelimiter>, e.g. <<IPAddress>>. The variables can be included anywhere within the template. Multiple variables may be added to a single cell.


The data variable name is prefixed and suffixed by predefined characters (defaults ‘<<‘ and ‘>>‘). These characters are defined in the Project Settings.


The general format of the IP data variables is as below:


<$<<VVV>>,<<ZZZ>>$>


   VVV – The name of the IP address variable from which the new IP address will be calculated, formatted as a standard variable including left and right delimiters.

   ZZZ – This value defines an offset, formatted as a integer. The value of ZZZ will be added to the IP address value of VVV before doing the variable replacement. This value can be either a specified amount, or a variable i.e. ‘1’ or a variable lookup <<IncrementVal>>.


Example 1, Add an offset to an IP address:


<$192.168.1.1,1$>


<$ and $> – The IP Variable delimiter characters

192.168.1.1 – IPSubnet variable to be referenced

1 – Offset the IP by 3 from the IPSubnet variable or a variable to lookup <<IncrementVal>>


Although it's possible to place an IP address directly into the template, it's not very useful.


Example 2, Add an offset to an IP address:


<$<<IPSubnet>>,3$>


<$ and $> – The IP Variable delimiter characters

<<IPSubnet>> – IPSubnet variable to be referenced

3 – Offset the IP by 3 from the IPSubnet variable or a variable to lookup <<IncrementVal>>


Example 3, Add an offset to an IP address:


<$<<IPSubnet>>,<<IncrementVal>>$>


<$ and $> – The IP Variable delimiter characters

<<IPSubnet>> – IPSubnet variable to be referenced

<<IncrementVal>> – A variable to lookup which defines the IP offset amount.


CIDR IP Variables


IP variables may be defined as CIDR variables instead of just IP address e.g. 10.1.0.0/24


The IP address and/or subnet length may be extracted from the variable. The subnet length may be converted to a subnet mask or inverse mask if required.


Example 1, Add 11 to a CIDR IP Address:


<$<<CIDR>>,IPV4,11$>


Example 2, Add the IncrementVal to CIDR IP Address:


<$<<CIDR>>,IPV4,<<IncrementVal>>$>


Example 3,  Extract the subnet length:


<$<<CIDR>>,LEN$>


Example 4,  Extract the subnet length and convert to a subnet mask:


<$<<CIDR>>,MASK$>


Example 5, Extract the subnet length and convert to a wildcard mask:


<$<<CIDR>>,IMASK$>


IPv6 Variables


IP variables may be defined as IPv6 variables instead of just IP address e.g. 2402:9400::0000:0000:0001/48


Example 1, Add 1 to a IPv6 Address:


<$2402:9400::0000:0000:0001/48,1$>


Example 2, Add the IncrementVal to IPv6 Address:


<$<<CIDR Variable>>,IPV6,<<IncrementVal>>$>