IPv6 routing number (routing)
Description
Returns the routing part of an IPv6 address.
How does it work in the search window?
Select Create field in the search window toolbar, then select the IPv6 routing number operation. You need to specify one argument:
Argument | Data type |
---|---|
IPv6Â mandatory | ip6 |
The data type of the values in the new field is integer.
Example
In the demo.ecommerce.data
table, we want to get the routing part of the clientIpAddress field. To do it, we need to transform it first into IPv6 format using the To IPv6 (ip6) operation. Then, click Create field on the query toolbar and select the IPv6 routing number operation.
The arguments needed to create the new field are:
IPv6 →  clientIpAddressIPv6 field obtained from the previous conversion operation.
Click Create field.
How does it work in LINQ?
When using the search window interface to manually introduce the argument instead of using a field, the To IPv6 (ip6) operation will be transparently performed to convert the string specified into an ip6 data type. This means that you will not notice that such an intermediate step exists.Â
Though this conversion is implicit while using the search window interface, it must be explicitly done when writing the query in LINQ, as shown in the second example below.
Use the operator select
... as
... and add the operation syntax to create the new field. This is the syntax for the IPv6 routing number operation:
routing(ip6)
Example
You can copy the following LINQ script and try the above example on the demo.ecommerce.data
table.Â
from demo.ecommerce.data
select ip6(clientIpAddress) as clientIpAddressIPv6,
routing(clientIpAddressIPv6) as Ipv6Routing
You can copy the following LINQ script to see how the string conversion must be explicitly performed in LINQ when specifying the argument instead of using a field.
from demo.ecommerce.data
select host(ip6("2001:db8:85a3::8a2e:370:7334")) as IPv6Routing