Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Configuring Tag Rules

Tag rules include one or more term statements that identify the HTTP enrichment actions to take when the conditions in the term are matched. You must configure at least one tag in the then clause of a term, and you can configure multiple tags.

Terms are evaluated in the order they are configured. If a data packet matches all the criteria in the from statement in a term, then the actions specified in the then statement of the term are applied. If the from statement does not identify any criteria, then all traffic matches. After a data packet matches a term, further terms are not evaluated. If no terms match, then the HTTP header is not enriched.

To configure a tag rule:

  1. Configure the list of tag attributes that may be used in tag rules.

    The tag attributes currently supported for Adaptive Services are apn, ggsnipv4, ggsnipv6, imei, imsi, ipv4addr, ipv6addr, and msisdn. To configure multiple tag attributes, include them in square brackets ([ ]). Starting in Junos 20.2R1 IPv4 and IPv6 tags for HTTP Header Enrichment are supported for Next Gen Services on MX240, MX480 and MX960. No other tags are supported for Next Gen Services in this release.

    For example:

  2. Configure a name for the tag rule.

    For example:

  3. Configure a term for the tag rule.
    Note:

    The term argument must have a numeric value.

    For example:

  4. (Optional) Specify the prefix that the HTTP request destination IP address must match.

    For example:

    You can also specify the type of address to match:

    You can specify multiple prefixes or address types by including the destination-address statement multiple times.

  5. (Optional) Specify an IP address range that the HTTP request destination IP address must match.

    For example:

    You can specify multiple address ranges by including the destination-address-range statement multiple times.

  6. (Optional) Specify the destination prefix list that the HTTP request destination IP address must match. The prefix list must already be defined at the [edit policy-options prefix-list] hierarchy level.

    For example:

    You can specify multiple prefix lists by including the destination-prefix-list statement multiple times.

  7. (Optional) Specify any addresses that you want to exclude from matching the HTTP request destination IP address with the except statement. To exclude addresses, you must also configure addresses that do match in a destination-address, destination-address-range, or destination-prefix-list statement at the [edit services hcm tag-rule rule-name term term-number from] hierarchy level.

    For example:

    This matches all the addresses in the destination range except 10.10.10.9.

    You can use except in the following statements at the [edit services hcm tag-rule rule-name term term-number from] hierarchy level:

  8. (Optional) Specify a port range that the HTTP request destination port number must match.

    You can specify multiple port ranges by including the destination-port-range statement multiple times.

    Note:

    If you do not specify any ports or port ranges to match, then all ports are matched.

  9. (Optional) Specify the HTTP request destination port number that must be matched.

    You can specify multiple ports by including the destination-ports statement multiple times.

  10. (Optional) Specify that you want to apply all HTTP header enrichment actions specified in the then statement of the tag rule to all HTTP requests by not including any matching conditions in the from statement. You must include a from statement in each term of a tag rule.

    For example:

  11. Configure a name for a tag.

    For example:

  12. Configure the tag header that the tag applies to the HTTP header.

    For example:

    You can configure a maximum of 16 unique tag headers.

    The header values cannot be accept, accept-charset, accept-encoding, accept-language, authorization, expect, host, if-match, if-modified-since, if-none-match, if-range, if-unmodified-since, max-forwards, proxy-authorization, referer, user-agent, or x-moz. These header values are reserved; you cannot configure them.

  13. Specify the tag attribute that the tag applies to the HTTP header. To specify multiple attributes at one time, include the attributes in square brackets ([]).
    Note:

    The tag attribute must be listed in the tag attributes configured in Step 1.

    For example:

  14. Specify the separator that the tag uses in the HTTP header.

    For example:

  15. (Optional) Specify a hash method and prefix key for the insertion of the tag in the HTTP header.

    Currently, only the md5 hash method is supported.

    For example:

  16. (Optional) Enable the collection of statistics for HTTP header enrichment for the tag rule.
  17. (Optional) Configure how the tag replaces a byte of the IPv4 or IPv6 user address with a different value in the HTTP header.

    To identify the byte you want to replace, enter 255 for IPv4 or ff for IPv6 in the corresponding byte of the ipv4-mask or ipv6-mask and enter zero in the other bytes.

    To specify the new value for that byte, enter the value in the corresponding byte of the ipv4-or-value or the ipv6-or-value and enter zero in the other bytes.

    For example, the following replaces the first byte of the IPv4 user address with the value 168:

  18. If you want to configure more tags for the then statement in the term, repeat Step 11 through Step 17.
  19. If you want to configure another term statement for the tag rule, repeat Step 3 through Step 18.
Release History Table
Release
Description
20.2R1
Starting in Junos 20.2R1 IPv4 and IPv6 tags for HTTP Header Enrichment are supported for Next Gen Services on MX240, MX480 and MX960. No other tags are supported for Next Gen Services in this release.