タグ ルールの設定
タグ ルールには、条件が一致したときに実行する HTTP エンリッチメント アクションを識別する 1 つ以上term
のterm
ステートメントが含まれます。の節でthen
少なくとも 1 つtag
を設定する必要があり、複数のterm
タグを設定できます。
条件は、構成順に評価されます。データ パケットが、a term
のステートメント内from
のすべての基準に一致する場合、そのステートメントterm
でthen
指定されたアクションが適用されます。ステートメントが基準をfrom
識別しない場合、すべてのトラフィックが一致します。データ パケットが条件と一致した後は、それ以降の条件は評価されません。条件が一致しない場合、HTTP ヘッダーはエンリッチされません。
タグ ルールを設定するには、
- タグ ルールで使用できるタグ属性のリストを設定します。
[edit services hcm] user@host# set tag-attribute tag-attr-name
アダプティブ サービスで現在サポートされているタグ属性は
apn
、 、 、ggsnipv4
imsi
imei
ipv4addr
ggsnipv6
、ipv6addr
およびmsisdn
です。複数のタグ属性を設定するには、それらを角括弧([])に含めます。Junos 20.2R1 から、HTTP ヘッダー エンリッチメント用の IPv4 および IPv6 タグは、MX240、MX480、MX960 の次世代サービスでサポートされています。このリリースでは、次世代サービスでは他のタグはサポートされていません。例えば:
[edit services hcm] user@host# set tag-attribute [msisdn apn]
- タグ ルールの名前を設定します。
[edit services hcm] user@host# set tag-rule rule-name
例えば:
[edit services hcm] user@host# set tag-rule rule1
- タグ ルールの条件を設定します。
[edit services hcm set tag-rule rule-name] user@host# set term term-number
メモ:引数には
term
数値が必要です。例えば:
[edit services hcm set tag-rule rule1] user@host# set term 1
- (オプション)HTTP 要求宛先 IP アドレスが一致する必要があるプレフィックスを指定します。
[edit services hcm tag-rule rule-name term term-number from] user@host# set destination-address prefix
例えば:
[edit services hcm tag-rule rule1 term 1 from] user@host# set destination-address 192.0.2.0/24
一致するアドレスのタイプを指定することもできます。
[edit services hcm tag-rule rule-name term term-number from] user@host# set destination-address (any-ipv4 | any-ipv6 | any-unicast)
ステートメントを複数回含めると、複数のプレフィックスまたはアドレス タイプを
destination-address
指定できます。 - (オプション)HTTP 要求宛先 IP アドレスが一致する必要がある IP アドレス範囲を指定します。
[edit services hcm tag-rule rule-name term term-number from] user@host# set destination-address-range low address high address
例えば:
[edit services hcm tag-rule rule1 term 1 from] user@host# set destination-address-range low 10.10.10.1 high 10.10.10.255
ステートメントを複数回含めると、複数のアドレス範囲を
destination-address-range
指定できます。 - (オプション)HTTP リクエスト宛先 IP アドレスが一致する宛先プレフィックス リストを指定します。プレフィックス リストは、階層レベルですでに定義されている
[edit policy-options prefix-list]
必要があります。[edit services hcm tag-rule rule-name term term-number from] user@host# set destination-prefix-list prefix-name
例えば:
[edit services hcm tag-rule rule1 term 1 from] user@host# set destination-prefix-list customer1
ステートメントを複数回含めると、複数のプレフィックス リストを
destination-prefix-list
指定できます。 - (オプション)ステートメントと HTTP 要求宛先 IP アドレスを照会しないように除外するアドレスを
except
指定します。アドレスを除外するには、階層レベルで 、destination-address-range
、またはdestination-prefix-list
ステートメント[edit services hcm tag-rule rule-name term term-number from]
でdestination-address
一致するアドレスを設定する必要もあります。例えば:
[edit services hcm tag-rule rule1 term 1 from] user@host# set destination-address-range low 10.10.10.1 high 10.10.10.255 user@host# set destination-address 10.10.10.9/32 except
これは、10.10.10.9 を除く宛先範囲のすべてのアドレスと一致します。
階層レベルでは、以下のステートメントを
[edit services hcm tag-rule rule-name term term-number from]
使用except
できます。destination-address { any-ipv4 except; any-ipv6 except; any-unicast except; prefix except; } destination-address-range { high address low address except; } destination-prefix-list { prefix-name except; }
- (オプション)HTTP 要求宛先ポート番号が一致する必要があるポート範囲を指定します。
[edit services hcm tag-rule rule-name term term-number from] user@host# set destination-port-range high port-number low port-number
ステートメントを複数回含めて、複数のポート範囲を
destination-port-range
指定できます。メモ:一致するポートまたはポート範囲を指定しない場合は、すべてのポートが一致します。
- (オプション)照合する必要がある HTTP 要求宛先ポート番号を指定します。
[edit services hcm tag-rule rule-name term term-number from] user@host# set destination-ports value
ステートメントを複数回含めると、複数のポートを
destination-ports
指定できます。 - (オプション)ステートメントに一致する条件を含めないことによって、タグ ルールのステートメントで
then
指定されたすべての HTTP ヘッダー エンリッチメント アクションをすべての HTTP 要求にfrom
適用することを指定します。タグ ルールのそれぞれにterm
ステートメントをfrom
含める必要があります。[edit services hcm tag-rule rule-name term term-number ] user@host# set from
例えば:
[edit services hcm tag-rule rule2 term 1] user@host# set from [edit services hcm tag-rule rule2 term 1] user@host# set then count
- タグの名前を設定します。
[edit services hcm tag-rule rule-name term term-number then] user@host# set tag tag-name
例えば:
[edit services hcm tag-rule rule1 term 1 then] user@host# set tag msisdn-tag
- タグが HTTP ヘッダーに適用されるタグ ヘッダーを設定します。
[edit services hcm tag-rule rule-name term term-number then tag tag-name] user@host# set tag-header header
例えば:
[edit services hcm tag-rule rule1 term 1 then tag msisdn-tag] user@host# set tag-header X_MSISDN
最大 16 個の一意のタグ ヘッダーを設定できます。
値はheader、 、 、
accept-encoding
、accept-language
、authorization
、if-modified-since
if-match
user-agent
referer
proxy-authorization
if-range
expect
max-forwards
host
if-unmodified-since
if-none-match
またはx-moz
とすることはできません。accept
accept-charset
これらのヘッダー値は予約済みです。構成することはできません。 - タグが HTTP ヘッダーに適用されるタグ属性を指定します。複数の属性を一度に指定するには、属性を角括弧([])に含めます。
[edit services hcm tag-rule rule-name term term-number then tag tag-name] user@host# set tag-attribute [tag-attr-name]
メモ:タグ属性は、ステップ 1 で設定されたタグ属性にリストされている必要があります。
例えば:
[edit services hcm tag-rule rule1 term 1 then tag msisdn-tag] user@host# set tag-attribute msisdn
- タグが HTTP ヘッダーで使用する区切り記号を指定します。
[edit services hcm tag-rule rule-name term term-number then tag tag-name] user@host# set tag-separator separator
例えば:
[edit services hcm tag-rule rule1 term 1 then tag msisdn-tag] user@host# set tag-separator /
- (オプション)HTTP ヘッダーにタグを挿入するためのハッシュ メソッドとプレフィックス キーを指定します。
[edit services hcm tag-rule rule-name term term-number then tag tag-name encrypt] user@host# set hash algorithm prefix hash-prefix
現在、ハッシュメソッドのみが
md5
サポートされています。例えば:
[edit services hcm tag-rule rule1 term 1 then tag msisdn-tag encrypt] user@host# set hash md5 prefix gatewaykey1
- (オプション)タグ ルールの HTTP ヘッダー エンリッチメントの統計情報の収集を有効にします。
[edit services hcm tag-rule rule-name term term-number then user@host# set count
- (オプション)タグが、IPv4 または IPv6 ユーザー アドレスのバイトを HTTP ヘッダーの別の値に置き換える方法を構成します。
[edit services hcm tag-rule rule-name term term-number then tag tag-name] user@host# set (ipv4-mask ipv4-mask | ipv6-mask ipv6-mask) (ipv4-or-value ipv4-or-value | ipv6-or-value ipv6-or-value)
置換するバイトを識別するには、対応するバイトの IPv4 または ff IPv6 に対して or
ipv6-mask
を入力255し、他のipv4-mask
バイトにゼロを入力します。そのバイトの新しい値を指定するには、or
ipv6-or-value
の対応するバイトに値をipv4-or-value
入力し、もう一方のバイトにゼロを入力します。例えば、以下は、IPv4 ユーザー・アドレスの最初のバイトを 168 の値に置き換えます。
[edit services hcm tag-rule tag1 term term1 then tag subscip4] user@host# set ipv4-mask 255.0.0.0 ipv4-or-value 168.0.0.0
- 条件内のステートメントに対してさらにタグを
then
設定する場合は、ステップ 11 から ステップ 17 を繰り返します。 - タグ ルールに対して別
term
のステートメントを設定する場合は、ステップ 3 から ステップ 18 を繰り返します。