ひよっこエンジニアの備忘録

日常とかSEとしての備忘を書いていきます。

NSX-T「外部インターフェイスの BFD が停止」アラームの対処

NSX-T環境にタイトルの「外部インターフェイスの BFD が停止」アラームが出力されていた。


(解消前の画面キャプチャを取得し忘れており、アラーム状態は[解決済み]になっています。。)

最初のレポートが2024/01/02 17:39:16であることから、前回NSX Managerをリストアした後からアラームがオープン状態になっていたっぽいです。

今回はアラーム対処の過程を記事にします。

[利用環境]

VMware ESXi 7.0.3 build-21686933
VMware VirtualCenter 7.0.3 build-21290409
VMware NSX Software, Version 3.2.2.0.0.20737193
VyOS 1.2.9-S1



[構成]

構成としてはNSXのTier0 GWと外部(物理)ルータ見立てのvyos間を192.168.199.0/24のネットワークに接続し、iBGPで接続しつつネイバーをBFDで監視しています。

NSX側はnsxe001/002のEdge2台でClusterを組み、Tier0 GWに割り当てています。

以下mermaidで書いたざっくり構成図です。

[対応内容]

まずはNSX Managerに表示されている「外部インターフェイスの BFD が停止」アラームの内容から確認します。

説明
ルーター 331d75a5-bf48-4c17-8466-54aea1442057 で、ピア 192.168.199.254 の BFD セッションが停止しています。
推奨アクション
1. NSX CLI コマンド `get logical-routers` を呼び出します。
2. サービス ルーター 13b4e02e-3f9b-4d14-a24e-eb1c542ab332 に切り替えます。
3. NSX CLI コマンド `ping 192.168.199.254` を呼び出して、接続を確認します。


ルーター 331d75a5-bf48-4c17-8466-54aea1442057」はT0GW001のDRを指しているようです。

nsxe001> get logical-routers | find  331d75a5-bf48-4c17-8466-54aea1442057
Sat Jan 20 2024 UTC 10:22:18.623
331d75a5-bf48-4c17-8466-54aea1442057   9      1      DR-T0GW001                        DISTRIBUTED_ROUTER_TIER0    8       8/50000

nsxe001>


が、、実際のところはT0DRではなくT0SR(13b4e02e-3f9b-4d14-a24e-eb1c542ab332)上で実行されるvyos向けBFDが落ちているということみたいです。

nsxe001> get log-file syslog | find BFD-STATE-DOWN
2024-01-20T11:53:57.950Z nsxe001 NSX 16485 ROUTING [nsx@6876 comp="nsx-edge" subcomp="rcpm" s2comp="rcpm-bfd-dp" level="INFO"] BFD event from DP - Local_IP:192.168.199.251 Remote_IP:192.168.199.254 State: BFD-STATE-DOWN
2024-01-20T11:53:57.368Z nsxe001 NSX 16485 FABRIC [nsx@6876 comp="nsx-edge" subcomp="rcpm" s2comp="routing-service-realization" level="INFO"] Alarm for BFD peer 192.168.199.254, peer_uuid: 00006000-0000-000b-0000-00000000000a in SR 13b4e02e-3f9b-4d14-a24e-eb1c542ab332, state=BFD-STATE-DOWN
nsxe001>
nsxe001> get logical-router | find 13b4e02e-3f9b-4d14-a24e-eb1c542ab332
Sat Jan 20 2024 UTC 16:25:50.554
13b4e02e-3f9b-4d14-a24e-eb1c542ab332   5      10     SR-T0GW001                        SERVICE_ROUTER_TIER0        5       1/50000

nsxe001>


NSX Edge: nsxe001でパケットキャプチャをとってみたところ、どうやらNSX EdgeからはBFDパケットを出しているものの対向側からBFDパケット返ってきていません。。

$ tshark -ta -r /tmp/bfd_before.pcap -Y bfd
Running as user "root" and group "root". This could be dangerous.
    3 19:54:04.989870 192.168.199.251 ? 192.168.199.254 BFD Control 66 Diag: No Diagnostic, State: Down, Flags: 0x00
 1263 19:54:05.900482 192.168.199.251 ? 192.168.199.254 BFD Control 66 Diag: No Diagnostic, State: Down, Flags: 0x00
 1286 19:54:06.660991 192.168.199.251 ? 192.168.199.254 BFD Control 66 Diag: No Diagnostic, State: Down, Flags: 0x00
 1319 19:54:07.490319 192.168.199.251 ? 192.168.199.254 BFD Control 66 Diag: No Diagnostic, State: Down, Flags: 0x00
 1373 19:54:08.299664 192.168.199.251 ? 192.168.199.254 BFD Control 66 Diag: No Diagnostic, State: Down, Flags: 0x00
$
$ tshark -ta -r /tmp/bfd_before.pcap -Y bfd -V
Frame 3: 66 bytes on wire (528 bits), 66 bytes captured (528 bits)
<snip>
Internet Protocol Version 4, Src: 192.168.199.251, Dst: 192.168.199.254
<snip>
BFD Control message
    001. .... = Protocol Version: 1
    ...0 0000 = Diagnostic Code: No Diagnostic (0x00)
    01.. .... = Session State: Down (0x1) <<<<<<<<<<<<
    Message Flags: 0x40
        0... .. = Poll: Not set
        .0.. .. = Final: Not set
        ..0. .. = Control Plane Independent: Not set
        ...0 .. = Authentication Present: Not set
        .... 0. = Demand: Not set
        .... .0 = Multipoint: Not set
    Detect Time Multiplier: 7 (= 7000 ms Detection time)
    Message Length: 24 bytes
    My Discriminator: 0xbdba6167
    Your Discriminator: 0x00000000
    Desired Min TX Interval: 1000 ms (1000000 us)
    Required Min RX Interval: 1000 ms (1000000 us)
    Required Min Echo Interval:    0 ms (0 us







若干vyos側が怪しいので設定確認。案の定BFDの設定が入っておりませんでした…
これではBFDのリプライを返せるわけがなく、双方向での監視不可でBFDは機能しませんのでvyos側の設定漏れが原因と思われますね。

vyos@vyos001:~$ show configuration commands | match protocols
set protocols bgp 65001 address-family ipv4-unicast network 192.168.10.0/24
set protocols bgp 65001 neighbor 192.168.10.254 remote-as '65505'
set protocols bgp 65001 neighbor 192.168.199.35 remote-as '65035'
set protocols bgp 65001 neighbor 192.168.199.35 timers holdtime '90'
set protocols bgp 65001 neighbor 192.168.199.35 timers keepalive '30'
set protocols bgp 65001 neighbor 192.168.199.250 address-family ipv4-unicast default-originate
set protocols bgp 65001 neighbor 192.168.199.250 address-family ipv4-unicast route-map export 'TO-NSXT-T0SR-SBY'
set protocols bgp 65001 neighbor 192.168.199.250 remote-as '65000'
set protocols bgp 65001 neighbor 192.168.199.251 address-family ipv4-unicast default-originate
set protocols bgp 65001 neighbor 192.168.199.251 remote-as '65000'
set protocols bgp 65001 timers holdtime '90'
set protocols bgp 65001 timers keepalive '30'
set system syslog global facility protocols level 'debug'
vyos@vyos001:~$
vyos@vyos001:~$ show protocol bfd peer
BFD Peers:
vyos@vyos001:~$


一応NSX側も見てみましたがこちらは問題なくBFDの設定が入っていました。

nsxe001> get logical-router 13b4e02e-3f9b-4d14-a24e-eb1c542ab332 bfd-config
Sat Jan 20 2024 UTC 10:42:01.218
Logical Router
UUID           : 13b4e02e-3f9b-4d14-a24e-eb1c542ab332
vrf            : 5
lr-id          : 10
name           : SR-T0GW001
type           : PLR-SR

Global BFD configuration
    Enabled        : True
    Min RX Interval: 500
    Min TX Interval: 500
    Min RX TTL     : 255
    Multiplier     : 3

Port               : fe1fbe40-88ba-4c08-b107-9aa2e390d442

Session BFD configuration

    Source         : 192.168.199.251
    Peer           : 192.168.199.254
    Enabled        : True
    Min RX Interval: 1000
    Min TX Interval: 1000
    Min RX TTL     : 255
    Multiplier     : 7

nsxe001>
nsxe001>
nsxe001> get logical-router 13b4e02e-3f9b-4d14-a24e-eb1c542ab332 bfd-sessions
Sat Jan 20 2024 UTC 10:42:13.248
BFD Session
Dest_port                     : 3784
Diag                          : No Diagnostic
Encap                         : vlan
Forwarding                    : last false (current false)
Interface                     : fe1fbe40-88ba-4c08-b107-9aa2e390d442
Keep-down                     : false
Last_cp_diag                  : No Diagnostic
Last_cp_rmt_diag              : No Diagnostic
Last_cp_rmt_state             : down
Last_cp_state                 : down
Last_fwd_state                : DOWN
Last_local_down_diag          : No Diagnostic
Last_remote_down_diag         : No Diagnostic
Local_address                 : 192.168.199.251
Local_discr                   : 3183108455
Min_rx_ttl                    : 255
Multiplier                    : 7
Received_remote_diag          : No Diagnostic
Received_remote_state         : down
Remote_address                : 192.168.199.254
Remote_admin_down             : false
Remote_diag                   : No Diagnostic
Remote_discr                  : 0
Remote_min_rx_interval        : 0
Remote_min_tx_interval        : 0
Remote_multiplier             : 0
Remote_state                  : down
Router                        : 13b4e02e-3f9b-4d14-a24e-eb1c542ab332
Router_down                   : false
Rx_cfg_min                    : 1000
Rx_interval                   : 1000
Service-link                  : false
Session_type                  : LR_PORT
State                         : down <<<<<<<<<<<<
Tx_cfg_min                    : 1000
Tx_interval                   : 1000

nsxe001>


vyosにBFDの設定を追加するためconfig投入!

configure

set protocols bfd peer 192.168.199.250 echo-mode
set protocols bfd peer 192.168.199.250 interval transmit 1000
set protocols bfd peer 192.168.199.250 interval receive 1000
set protocols bfd peer 192.168.199.250 interval multiplier 7

set protocols bfd peer 192.168.199.251 echo-mode
set protocols bfd peer 192.168.199.251 interval transmit 1000
set protocols bfd peer 192.168.199.251 interval receive 1000
set protocols bfd peer 192.168.199.251 interval multiplier 7

commit
save


vyosとNSX両方でBFDがUPしアラームが解消しました!

###vyos
vyos@vyos001:~$ show protocols bfd peer counters
BFD Peers:
        peer 192.168.199.250 vrf default
                Control packet input: 501 packets
                Control packet output: 1662 packets
                Echo packet input: 0 packets
                Echo packet output: 0 packets
                Session up events: 1 <<<<<<<<<<<<
                Session down events: 0
                Zebra notifications: 1

        peer 192.168.199.251 vrf default
                Control packet input: 498 packets
                Control packet output: 1664 packets
                Echo packet input: 0 packets
                Echo packet output: 0 packets
                Session up events: 1 <<<<<<<<<<<<
                Session down events: 0
                Zebra notifications: 1

vyos@vyos001:~$
nsxe001> get logical-router 13b4e02e-3f9b-4d14-a24e-eb1c542ab332 bfd-sessions
Sat Jan 20 2024 UTC 11:59:46.788
BFD Session
Dest_port                     : 3784
Diag                          : No Diagnostic
Encap                         : vlan
Forwarding                    : last true (current true)
Interface                     : fe1fbe40-88ba-4c08-b107-9aa2e390d442
Keep-down                     : false
Last_cp_diag                  : No Diagnostic
Last_cp_rmt_diag              : No Diagnostic
Last_cp_rmt_state             : up
Last_cp_state                 : up
Last_down_time                : 2024-01-20 11:53:57
Last_fwd_state                : UP
Last_local_down_diag          : Neighbor Signaled Session Down
Last_remote_down_diag         : No Diagnostic
Last_up_time                  : 2024-01-20 11:53:57
Local_address                 : 192.168.199.251
Local_discr                   : 3183108455
Min_rx_ttl                    : 255
Multiplier                    : 7
Received_remote_diag          : No Diagnostic
Received_remote_state         : up
Remote_address                : 192.168.199.254
Remote_admin_down             : false
Remote_diag                   : No Diagnostic
Remote_discr                  : 3941352967
Remote_min_rx_interval        : 1000
Remote_min_tx_interval        : 1000
Remote_multiplier             : 7
Remote_state                  : up
Router                        : 13b4e02e-3f9b-4d14-a24e-eb1c542ab332
Router_down                   : false
Rx_cfg_min                    : 1000
Rx_interval                   : 1000
Service-link                  : false
Session_type                  : LR_PORT
State                         : up <<<<<<<<<<<<
Tx_cfg_min                    : 1000
Tx_interval                   : 1000


NSX ManagerのAlarm状態も無事[解決済み]となったので本件解決です!

root@nsxm001:~# grep 'alarm.*event' /var/log/syslog
2024-01-20T11:25:04.989Z nsxm001 NSX 3522 MONITORING [nsx@6876 alarmId="4a3632e8-e3b2-4fb9-9b0c-35096d92f998" alarmState="RESOLVED" comp="nsx-manager" entId="00006000-0000-000b-0000-00000000000a" errorCode="MP701099" eventFeatureName="routing" eventSev="HIGH" eventState="Off" eventType="bfd_down_on_external_interface" level="ERROR" nodeId="df20f7b8-3a16-11ee-930d-005056b4a5ec" subcomp="monitoring"] In router 331d75a5-bf48-4c17-8466-54aea1442057, BFD session for peer 192.168.199.254 is up.
2024-01-20T11:25:14.987Z nsxm001 NSX 3522 MONITORING [nsx@6876 alarmId="8aca1b77-3994-4848-932c-7c25e38cffb8" alarmState="RESOLVED" comp="nsx-manager" entId="00006000-0000-000e-0000-00000000000d" errorCode="MP701099" eventFeatureName="routing" eventSev="HIGH" eventState="Off" eventType="bfd_down_on_external_interface" level="ERROR" nodeId="032561f8-3a17-11ee-b647-005056b4c567" subcomp="monitoring"] In router 331d75a5-bf48-4c17-8466-54aea1442057, BFD session for peer 192.168.199.254 is up.
2024-01-20T11:41:04.414Z nsxm001 NSX 4252 - [nsx@6876 audit="true" comp="nsx-manager" level="INFO" reqId="c77db8eb-46d5-48ae-baca-84fd078ea9f3" subcomp="manager" update="true" username="admin"] UserName="admin", ModuleName="NsxOverview", Operation="ReadAlarmOverview", Operation status="success", New value=[{"filter":"top_alarms_by_feature_event"} {}]

NSX(というかVMware製品全般)はGUI操作を基本としていてあまりCLI操作をしたことがないという方も多いと思いますが、トラブル調査時にはCLIも使えるほうが効率的に調査を進めることができます。
また物理ルータでパケットキャプチャを行う場合現地入りや設定変更が必要だったり本番環境だと非常にハードルが高いのですが、NSX Edgeは設定不要で遠隔からパケットキャプチャを取得することができます。
トラブル発生時はパケットキャプチャも有効に活用できるとよいですね。