BGPエラーメッセージ
BGP更新メッセージのエラー処理について
BGPメッセージは、いずれかのメッセージ属性に不正な形式がある場合、不正な形式と見なされます。BGPセッションに参加しているルーターが不正な形式の更新メッセージを受信すると、デフォルトではセッション全体がリセットされます。有効なルートを持つ更新メッセージも影響を受けるため、これは望ましくありません。このような望ましくない動作を回避するには、BGP更新メッセージのエラー処理を変更する必要があります。
BGP更新メッセージのエラー処理を設定するには、[edit protocols bgp]、[edit protocols bgp group group-name]、または[edit protocols bgp group group-name neighbor address]階層レベルでbgp-error-toleranceステートメントを設定します。
bgp-error-tolerance { malformed-route-limit number; malformed-update-log-interval seconds; no-malformed-route-limit; }
属性タイプフィールドの値と競合する属性フラグが属性に含まれている場合、属性フラグは正しい値にリセットされ、更新メッセージが処理されます。属性フラグの拡張長ビットの値は変更されません。この値は、属性の長さが1オクテットか2オクテットかを定義するためです。したがって、属性フラグの値は、BGP更新パケットの解析方法に影響します。
パス属性の属性フラグ値に明示的な指定はありません。
Junos OSリリース24.2R1以降、BGPエラー処理がデフォルトで有効になります。この設定ステートメントでは、 malformed-route-limit、 malformed-update-log-interval、 no-malformed-route-limit などのサブオプションを設定することができます。 bgp-error-tolerance ステートメントを削除しても、この機能は有効なままで、サブオプションはデフォルト値にリセットされます。
不正な形式の更新メッセージは、メッセージに含まれる属性の値に応じて、ケースバイケースで処理されます。不正な形式の BGP 更新メッセージを処理するには、重大度の低い順に 3 つの方法があります。
-
Notification message approach—不正な形式のメッセージエラーはローカルに記録され、エラーコード更新メッセージがピアの管理者に送信され、BGPセッション全体がリセットされます。
このアプローチは、次の場合に選択されます。
-
BGP 更新メッセージには、MP reach 属性または MP unreach 属性が含まれています。
-
属性の長さと属性の長さフィールドの値が一致していないため、NLRI フィールドまたは BGP 更新メッセージを正しく解析できません。
-
-
Treat-as-withdraw approach—
keep noneステートメントが設定されていない限り、不正な形式の更新メッセージ内のすべてのルートは非表示ルートとして扱われます。その場合、ルートは破棄されます。keep noneステートメントがない場合、非表示の不正な形式のルートの数には制限が設定され、これを超えるとルートを破棄し、それ以上の不正な形式のルートが非表示になるのを防ぎます。Junos OSは、不正な形式のルート制限に達すると、新たに受信した不正な形式のルートを削除します。 -
Attribute discard approach—更新メッセージ内の不正な属性は破棄されます。ただし、メッセージは処理されます。破棄する属性がルートの選択やインストールに影響を与える可能性がある場合は、このアプローチの使用はお勧めしません。
注:属性が更新メッセージに複数回出現した場合、最初の属性以外の属性の出現はすべて破棄され、メッセージが処理されます。
BGP更新メッセージは、以下の属性についてスキャンされ、これらの属性の値に基づいて不正な形式として扱われます。
-
The origin attribute—撤退として扱うアプローチによって処理されます。
-
The AS path attribute—撤退として扱うアプローチによって処理されます。
-
The AS 4 path attribute—属性破棄アプローチによって処理されます。
-
The aggregator attribute—属性破棄アプローチによって処理されます。
-
The aggregator 4 attribute—属性破棄アプローチによって処理されます。
-
The next-hop attribute—撤退として扱うアプローチによって処理されます。
-
The multiple exit discriminator attribute—撤退として扱うアプローチによって処理されます。
-
The local preference attribute—撤退として扱うアプローチによって処理されます。
-
The atomic aggregate attribute—属性破棄アプローチによって処理されます。
-
The community attribute—撤退として扱うアプローチによって処理されます。
-
The extended community attribute—撤退として扱うアプローチによって処理されます。
-
The originator attribute—撤退として扱うアプローチによって処理されます。
-
The cluster attribute—撤退として扱うアプローチによって処理されます。
-
The PMSI attribute—撤退として扱うアプローチによって処理されます。
-
The MP reach attribute—通知メッセージアプローチによって処理されます。
-
The MP unreach attribute—通知メッセージアプローチによって処理されます。
-
The attribute set attribute—撤退として扱うアプローチによって処理されます。
-
The AIGP attribute—撤退として扱うアプローチによって処理されます。
-
Unknown attribute—BGPフラグがこれがオプションの属性であることを示さない場合、この不正な形式の属性は通知メッセージアプローチによって処理されます。
BGP更新メッセージに複数の不正な属性が含まれている場合、属性の1つによってトリガーされる最も厳しいアプローチが実行されます。
BGPエラーメッセージ出力の例を次に示します。
user@R1> show log messages Sep 18 17:54:13 R1 rpd[86600]: Received malformed update from 10.10.10.2 (External AS 64511) Sep 18 17:54:13 R1 rpd[86600]: Family inet-unicast, prefix 100.1.1.0/24 Sep 18 17:54:13 R1 rpd[86600]: Malformed Attribute ORIGIN(1) flag 0x40 length 1 error 6 (Unrecognized ORIGIN attribute). Sep 18 17:54:13 R1 rpd[86600]: Malformed Attribute LOCAL_PREF(5) flag 0x40 length 6 error 5 (Attribute length error).
この例では、オリジン(ORIGIN)とローカルプリファレンス(LOCAL_PREF)の属性の形式が正しくありません。
関連項目
例:BGP更新メッセージのエラー処理の設定
この例では、BGP エラー処理を設定する方法を示します。
要件
始める前に:
-
ルーターインターフェイスを設定します。
-
内部ゲートウェイプロトコル(IGP)を設定します。
-
BGPを設定します。
-
ルーティングポリシーを設定します。
概要
ルーティングデバイスが不正な属性を含む更新メッセージを受信すると、ルーターはセッションをリセットする必要があります。これは、RFC 4271、 A 境界ゲートウェイプロトコル 4 (BGP-4) で規定されています。セッションのリセットは、問題のある属性を持つルートだけでなく、セッション上で交換された他の有効なルートにも影響を与えます。さらに、この動作は、オプションの推移的属性の場合、潜在的なセキュリティ上の脆弱性となる可能性があります。不正な形式の更新メッセージによるルーティングへの影響を最小限に抑えるために、インターネットドラフトdraft-ietf-idr-error-handling-01.txt、 BGP UPDATEメッセージの改訂されたエラー処理 では、不正な属性を持つ更新メッセージBGP処理するための修正を指定しています。新しいエラー処理により、不正な形式のUPDATEメッセージで運ばれたルートを削除しながら、確立されたセッションを維持し、有効なルートの交換を維持することができます。
トポロジー
図1では、デバイスR1はデバイスR0との内部BGPピアリングセッションと、デバイスR2との外部BGPピアリングセッションを持っています。
例
ネットワークを不安定にする原因となる不正な形式の更新メッセージから保護するために、次に示すように、デバイスR1にはBGPエラー処理が設定されています。
bgp-error-tolerance {
malformed-update-log-interval 10;
malformed-route-limit 5;
}
デフォルトでは、BGPメッセージは、いずれかのメッセージ属性に不正な形式がある場合、不正な形式と見なされます。BGPセッションに参加しているルーターが不正な形式の更新メッセージを受信すると、セッション全体がリセットされます。 bgp-error-tolerance ステートメントはこの動作を上書きして、以下のBGPエラー処理が有効になるようにします。
-
致命的なエラーの場合、Junos OSはエラーコード更新メッセージというタイトルの通知メッセージを送信し、BGPセッションをリセットします。MP_{UN}REACH属性のエラーは致命的と見なされます。1つのBGPアップデートに複数のMP_{UN}REACH属性が存在する場合も、致命的なエラーと見なされます。Junos OSは、NLRIフィールドまたはBGP更新を正しく解析できない場合、BGPセッションをリセットします。BGP更新パケットの解析に失敗する原因は、属性の長さが属性値の長さと一致しない場合に発生することがあります。
-
一部の致命的ではないエラーについては、Junos OS は、BGP is 設定に
keep noneステートメントが含まれていない限り、不正な形式の BGP update メッセージに含まれるすべてのルートを取り消しルートとして扱い、非表示としてインストールします。Junos OS では、ORIGIN、AS_PATH、NEXT_HOP、MULTI_EXIT_DISC、LOCAL_PREF、ORIGINATOR、CLUSTER、ATTRSET、PMSI、コミュニティー、および拡張コミュニティーのいずれかの属性が関係する場合に、このエラー処理アプローチを使用します。さらに、必須の既知のパス属性のいずれかが欠落している場合、Junos OS は BGP アップデートを不正なものとして扱います。これらの不正な形式の非表示ルートのメモリ使用量を制限するために、Junos OSは、そのような不正な形式の非表示ルートの最大数に達すると、新しい不正な形式の非表示ルートのインストールを停止します。この例では、malformed-route-limitステートメントを使用して最大数を5に設定しています。デフォルト値は1000です。オプションで、形式が正しくない属性のために非表示になるルートを無制限に許可することもできます。そのためには、no-malformed-route-limitステートメントを含めます。 -
その他の致命的ではないエラーについては、Junos OS は不正な形式のパス属性を破棄し、BGP 更新メッセージの処理を続行します。ルートの選択やインストールに影響を与える可能性のあるパス属性にこのアプローチを使用することは安全ではありません。Junos OS では、ATOMIC_AGGREGATE、AGGREGATOR、AGGREGATOR4、AS4PATHのいずれかの属性が関係する場合に、このエラー処理アプローチを使用します。
不正なパケットのトラブルシューティングを容易にするために、Junos OS は、不正な形式のパス属性コード、フラグ、長さ、ピアとファミリーに関する情報、不正な形式の BGP アップデートの最初のプレフィックスをリストアップしたエラーを記録します。短時間で大量の不正なパケットを受信すると、不正な形式のパケットをログに記録すると、Junos OSのパフォーマンスが低下する可能性があります。パフォーマンスへの影響を制限するために、Junos OS は、不正な形式の更新をログに記録し、一定期間ログ記録を抑制し、概要をログに記録するアルゴリズムを実装しています。ログ抑制タイマーが終了すると、ソフトウェアはその間隔中に受信した不正な形式の属性の総数をログに記録します。この例では、 malformed-update-log-interval ステートメントを使用してタイマーを10秒に設定しています。デフォルト値は300秒(5分)です。
CLIクイックコンフィグレーション は、 図1に示すすべてのデバイスの構成を示しています。
セクション #d101e193__d101e403 は、デバイスR1の手順を説明しています。
設定
CLIクイックコンフィグレーション
この例をすばやく設定するには、以下のコマンドをコピーしてテキスト ファイルに貼り付け、改行を削除して、ネットワーク構成に合わせて必要な詳細を変更し、 [edit] 階層レベルのCLIにコマンドをコピー アンド ペーストします。
デバイスR0
set interfaces fe-1/2/0 unit 0 description to-R1 set interfaces fe-1/2/0 unit 0 family inet address 172.16.10.5/30 set interfaces lo0 unit 0 family inet address 192.168.0.3/32 set protocols bgp group internal-peers type internal set protocols bgp group internal-peers local-address 192.168.0.3 set protocols bgp group internal-peers export local-direct set protocols bgp group internal-peers neighbor 192.168.0.1 set protocols ospf area 0.0.0.0 interface fe-1/2/0.0 set protocols ospf area 0.0.0.0 interface lo0.0 passive set policy-options policy-statement local-direct from protocol [local direct] set policy-options policy-statement local-direct then accept set routing-options autonomous-system 64510 set routing-options router-id 192.168.0.3
デバイスR1
set interfaces fe-1/2/1 unit 0 description to-R2 set interfaces fe-1/2/1 unit 0 family inet address 10.10.10.1/30 set interfaces fe-1/2/0 unit 0 description to-R0 set interfaces fe-1/2/0 unit 0 family inet address 172.16.10.6/30 set interfaces lo0 unit 0 family inet address 192.168.0.1/32 set protocols bgp bgp-error-tolerance malformed-update-log-interval 10 set protocols bgp bgp-error-tolerance malformed-route-limit 5 set protocols bgp group internal-peers type internal set protocols bgp group internal-peers local-address 192.168.0.1 set protocols bgp group internal-peers export local-direct set protocols bgp group internal-peers neighbor 192.168.0.3 set protocols bgp group external-peers type external set protocols bgp group external-peers export local-direct set protocols bgp group external-peers peer-as 64511 set protocols bgp group external-peers neighbor 10.10.10.2 set protocols ospf area 0.0.0.0 interface fe-1/2/1.0 set protocols ospf area 0.0.0.0 interface fe-1/2/0.0 set protocols ospf area 0.0.0.0 interface lo0.0 passive set policy-options policy-statement local-direct from protocol [local direct] set policy-options policy-statement local-direct then accept set routing-options autonomous-system 64510 set routing-options router-id 192.168.0.1
デバイスR2
set interfaces fe-1/2/1 unit 0 description to-R1 set interfaces fe-1/2/1 unit 0 family inet address 10.10.10.2/30 set interfaces lo0 unit 0 family inet address 192.168.0.2/32 set protocols bgp group external-peers type external set protocols bgp group external-peers export local-direct set protocols bgp group external-peers peer-as 64510 set protocols bgp group external-peers neighbor 10.10.10.1 set protocols ospf area 0.0.0.0 interface fe-1/2/1.0 set protocols ospf area 0.0.0.0 interface lo0.0 passive set policy-options policy-statement local-direct from protocol [local direct] set policy-options policy-statement local-direct then accept set routing-options autonomous-system 64511 set routing-options router-id 192.168.10.2
手順
ステップバイステップの手順
次の例では、設定階層のさまざまなレベルに移動する必要があります。CLIのナビゲーションについては、『Junos OS CLIユーザーガイド』の「設定モードでのCLIエディターの使用」を参照してください。
BGPエラー処理を設定するには:
-
ルーター インターフェイスを設定します。
[edit interfaces] user@R1# set fe-1/2/1 unit 0 description to-R2 user@R1# set fe-1/2/1 unit 0 family inet address 10.10.10.1/30 user@R1# set fe-1/2/0 unit 0 description to-R0 user@R1# set fe-1/2/0 unit 0 family inet address 172.16.10.6/30 user@R1# set lo0 unit 0 family inet address 192.168.0.1/32
-
OSPFやIS-ISなどの内部ゲートウェイプロトコル(IGP)を設定します。
[edit protocols ospf area 0.0.0.0] user@R1# set interface fe-1/2/1.0 user@R1# set interface fe-1/2/0.0 user@R1# set interface lo0.0 passive
-
自律システム(AS)番号とルーターIDを設定します。
[edit routing-options] user@R1# set autonomous-system 64510 user@R1# set router-id 192.168.0.1
-
ルーティングポリシーを設定します。
[edit policy-options policy-statement local-direct] user@R1# set from protocol [local direct] user@R1# set then accept
-
EBGP セッションを設定します。
[edit protocols bgp group external-peers] user@R1# set type external user@R1# set export local-direct user@R1# set peer-as 64511 user@R1# set neighbor 10.10.10.2
-
IBGP セッションを設定します。
[edit protocols bgp group internal-peers] user@R1# set type internal user@R1# set local-address 192.168.0.1 user@R1# set export local-direct user@R1# set neighbor 192.168.0.3
-
BGPエラートレランスを有効にします。
[edit protocols bgp] user@R1# set bgp-error-tolerance
-
(オプション)ログ間隔を設定します。
[edit protocols bgp bgp-error-tolerance] user@R1# set malformed-update-log-interval 10
-
(オプション)保存する非表示ルートの数に制限を設定します。
[edit protocols bgp bgp-error-tolerance] user@R1# set malformed-route-limit 5
結果
設定モードから、 show interfaces、 show protocols、 show policy-options、 show routing-options コマンドを入力して設定を確認します。出力に意図した設定が表示されない場合は、この例の手順を繰り返して設定を修正します。
user@R1#
show interfaces
fe-1/2/0 {
unit 0 {
description to-R0;
family inet {
address 172.16.10.6/30;
}
}
}
fe-1/2/1 {
unit 0 {
description to-R2;
family inet {
address 10.10.10.1/30;
}
}
}
lo0 {
unit 0 {
family inet {
address 192.168.0.1/32;
}
}
}
user@R1# show protocols
bgp {
bgp-error-tolerance {
malformed-update-log-interval 10;
malformed-route-limit 5;
}
group internal-peers {
type internal;
local-address 192.168.0.1;
export local-direct;
neighbor 192.168.0.3;
}
group external-peers {
type external;
export local-direct;
peer-as 64511;
neighbor 10.10.10.2;
}
}
ospf {
area 0.0.0.0 {
interface fe-1/2/1.0;
interface fe-1/2/0.0;
interface lo0.0 {
passive;
}
}
}
user@R1#
show policy-options
policy-statement local-direct {
from protocol [local direct];
then accept;
}
user@R1#
show routing-options
router-id 192.168.0.1;
autonomous-system 64510;
デバイスの設定が完了したら、設定モードから commit を入力します。
検証
設定が正常に機能していることを確認します。
BGPネイバーセッションの確認
目的
BGP エラー トレランスが有効になっていることを確認し、不正なパス属性に関連するカウンターを表示します。
アクション
user@R1# show bgp neighbor
Peer: 10.10.10.2+50058 AS 64511 Local: 10.10.10.1+179 AS 64510
Type: External State: Established Flags: <Sync>
Last State: OpenConfirm Last Event: RecvKeepAlive
Last Error: None
Export: [ local-direct ]
Options: <Preference PeerAS Refresh>
Holdtime: 90 Preference: 170
Number of flaps: 0
Malformed attributes log interval: 10 route limit: 5
Attribute: ORIGIN(1) Last Received: 0 Total Received: 3
Attribute: LOCAL_PREF(5) Last Received: 0 Total Received: 2
Peer ID: 192.168.10.2 Local ID: 192.168.10.1 Active Holdtime: 90
Keepalive Interval: 30 Group index: 0 Peer index: 0
BFD: disabled, down
Local Interface: fe-1/2/1.0
NLRI for restart configured on peer: inet-unicast
NLRI advertised by peer: inet-unicast
NLRI for this session: inet-unicast
Peer supports Refresh capability (2)
Stale routes from peer are kept for: 300
Peer does not support Restarter functionality
NLRI that restart is negotiated for: inet-unicast
NLRI of received end-of-rib markers: inet-unicast
NLRI of all end-of-rib markers sent: inet-unicast
Peer supports 4 byte AS extension (peer-as 64511)
Peer does not support Addpath
Table inet.0 Bit: 10000
RIB State: BGP restart is complete
Send state: in sync
Active prefixes: 0
Received prefixes: 3
Accepted prefixes: 0
Suppressed due to damping: 0
Advertised prefixes: 2
Last traffic (seconds): Received 25 Sent 17 Checked 73
Input messages: Total 2702 Updates 10 Refreshes 0 Octets 51652
Output messages: Total 2701 Updates 6 Refreshes 0 Octets 51571
Output Queue[0]: 0
Peer: 192.168.10.3+179 AS 64510 Local: 192.168.10.1+51127 AS 64510
Type: Internal State: Established Flags: <Sync>
Last State: OpenConfirm Last Event: RecvKeepAlive
Last Error: None
Export: [ local-direct ]
Options: <Preference LocalAddress Refresh>
Local Address: 192.168.10.1 Holdtime: 90 Preference: 170
Number of flaps: 0
Malformed attributes log interval: 10 route limit: 5
Peer ID: 192.168.10.3 Local ID: 192.168.10.1 Active Holdtime: 90
Keepalive Interval: 30 Group index: 1 Peer index: 0
BFD: disabled, down
NLRI for restart configured on peer: inet-unicast
NLRI advertised by peer: inet-unicast
NLRI for this session: inet-unicast
Peer supports Refresh capability (2)
Stale routes from peer are kept for: 300
Peer does not support Restarter functionality
NLRI that restart is negotiated for: inet-unicast
NLRI of received end-of-rib markers: inet-unicast
NLRI of all end-of-rib markers sent: inet-unicast
Peer supports 4 byte AS extension (peer-as 64510)
Peer does not support Addpath
Table inet.0 Bit: 10001
RIB State: BGP restart is complete
Send state: in sync
Active prefixes: 0
Received prefixes: 3
Accepted prefixes: 0
Suppressed due to damping: 0
Advertised prefixes: 2
Last traffic (seconds): Received 5 Sent 24 Checked 51
Input messages: Total 417 Updates 3 Refreshes 0 Octets 8006
Output messages: Total 421 Updates 2 Refreshes 0 Octets 8136
Output Queue[0]: 0
意味
「不正な形式の属性」フィールドは、エラー許容度が有効になっていることを示しています。ログ間隔フィールドとルート制限フィールドに、設定された値が表示されます。
属性カウンターは、EBGP接続で、デバイスR2からいくつかの不正な属性が受信されたことを示しています。
非表示ルートのチェック
目的
非表示ルートに関する情報を表示し、非表示になっている理由をご確認ください。
アクション
user@R1> show route hidden detail
inet.0: 42 destinations, 45 routes (36 active, 0 holddown, 6 hidden)
10.0.0.0/32 (1 entry, 0 announced)
BGP
Next hop type: Router
Address: 0x93d8b0c
Next-hop reference count: 5
Source: 10.10.10.2
Next hop type: Router, Next hop index: 782
Next hop: via fe-1/2/1.0, selected
Session Id: 0x1
State: <Hidden Ext>
Local AS: 1 Peer AS: 1
Age: 5:32 Metric2: 1
Validation State: unverified
Task: BGP_1.10.10.5.62+56218
AS path: I (MalformedAttr)
Router ID: 192.168.0.2
10.0.0.1/32 (1 entry, 0 announced)
BGP
Next hop type: Router
Address: 0x93d8b0c
Next-hop reference count: 5
Source: 10.10.10.2
Next hop type: Router, Next hop index: 782
Next hop: via fe-1/2/1.0, selected
Session Id: 0x1
Indirect next hop: 953c000 - INH Session ID: 0x3
State: <Hidden Int Ext>
Local AS: 1 Peer AS: 1
Age: 5:32 Metric2: 1
Validation State: unverified
Task: BGP_1.10.10.5.62+56218
AS path: I (MalformedAttr)
Router ID: 192.168.0.2
意味
不正な形式の非表示ルートは、ASパスフィールドでMalformedAttrとしてマークされます。
clear bgp neighbor 10.10.10.2 malformed-routeコマンドを実行することで、非表示ルートを削除できます。
非表示ルートのソースの検証
目的
非表示ルートに関する情報を表示し、非表示になっている理由をご確認ください。
アクション
user@R1> show route receive-protocol bgp 10.10.10.2 detail hidden
inet.0: 42 destinations, 45 routes (36 active, 0 holddown, 6 hidden)
10.0.0.0/32 (1 entry, 0 announced)
Nexthop: 10.10.10.2
Localpref: 100
AS path: I (MalformedAttr)
10.0.0.1/32 (1 entry, 0 announced)
Nexthop: 10.10.10.2
Localpref: 100
AS path: I (MalformedAttr)
意味
Junos OSは、 show route receive-protocol bgp 10.10.10.2 detail hidden コマンドの出力のASパスフィールドにMalformedAttrを表示します。
clear bgp neighbor 10.10.10.2 malformed-routeコマンドを実行することで、非表示ルートを削除できます。