Vyatta(VyOS) OSPFルーティング設定 BFD併用

スポンサーリンク

Vyatta(VyOS)で、IPv4とIPv6のOSPF設定をまとめます。vyattaは比較的高機能で様々な設定ができるようですが、このページでは近年のクラウドやSDNと併用される事が多い「unicast neighbor」「BFD」の設定例を紹介します。

設定まとめ

IPv4 OSPFv2設定

以下のコマンドでOSPFを有効にするインターフェースを指定できます。「network <ネットワーク>」に含まれてるインターフェースに対してOSPFが有効化されます。

set protocols ospf area <エリアID> network <ネットワーク>

以下のコマンドでOSPF network typeを指定します。デフォルトは「broadcast」ですが、ブロードキャストやマルチキャストの疎通が出来ないクラウド環境やSDN環境ではユニキャストに変更しなければ、OSPF neighborを確立できません。

ユニキャストを使用するnetwork typeは「non-broadcast」です。

set protocols ospf interface <インターフェース> network <ネットワークタイプ>

以下のコマンドでhelloとdeadを変更する事ができます。helloとdeadのデフォルト設定はnetwork typeによって異なります。

set protocols ospf interface <インターフェース> dead-interval <秒指定>
set protocols ospf interface <インターフェース> hello-interval <秒指定>

network typeを「non-broadcast」とする時に、対向機器のIPアドレスを指定します。

set protocols ospf neighbor <対向IPアドレス>

IPv6 OSPFv3設定

以下のコマンドでOSPFを有効にするインターフェースを指定できます。

set protocols ospfv3 area <エリアID> interface <インターフェース>

以下のコマンドでOSPF network typeを指定します。デフォルトは「broadcast」です。Vyatta 1.4時点では「broadcast」「point-to-point」「point-to-multipoint」しか選べず、unicastを使用する「non-broadcast」には対応していません。

set protocols ospfv3 interface <インターフェース> network <ネットワークタイプ>

以下のコマンドでhelloとdeadを変更する事ができます。helloとdeadのデフォルト設定はnetwork typeによって異なります。


set protocols ospfv3 interface <インターフェース> dead-interval <秒指定>
set protocols ospfv3 interface <インターフェース> hello-interval <秒指定>

BFD neighbor

以下のコマンドでBFD peerの定義が可能です。IPv6の場合は、送信元IPv6アドレスの明示指定が必要です。

set protocols bfd peer <対向IPv4アドレス> 
set protocols bfd peer <対向IPv6アドレス> source address <送信元IPv6アドレス>

デフォルト設定はecho-intervalが300ミリ秒で、multiplierは3回で、transmitは50ミリ秒です。このタイマーをチューニングするには以下コマンドを使います。

set protocols bfd peer <対向IPv4アドレス> interval echo-interval <ミリ秒指定>
set protocols bfd peer <対向IPv4アドレス> interval multiplier <回数>
set protocols bfd peer <対向IPv4アドレス> interval transmit <ミリ秒指定>
set protocols bfd peer <対向IPv6アドレス> interval echo-interval <ミリ秒指定>
set protocols bfd peer <対向IPv6アドレス> interval multiplier <回数>
set protocols bfd peer <対向IPv6アドレス> interval transmit <ミリ秒指定>

BFD peerが確立されたかどうかは「show protocols bfd peer」で確認します。

vyos@vy001:~$ show protocols bfd peer
BFD Peers:
        peer 192.168.12.2 vrf default
                ID: 545079937
                Remote ID: 2792572690
                Active mode
                Status: up
                Uptime: 24 minute(s), 49 second(s)
                Diagnostics: ok
                Remote diagnostics: ok
                Peer Type: configured
                Local timers:
                        Detect-multiplier: 3
                        Receive interval: 300ms
                        Transmission interval: 60ms
                        Echo transmission interval: 250ms
                Remote timers:
                        Detect-multiplier: 3
                        Receive interval: 300ms
                        Transmission interval: 60ms
                        Echo transmission interval: 250ms

  <omitted>

BFDとOSPFの関連付け

BFDとOSPFを紐づけるには以下の設定を使います。

set protocols ospf interface <インターフェース> bfd 
set protocols ospfv3 interface <インターフェース> bfd 

「show ip ospf neighbor detail」「show ipv6 ospfv3 neighbor detail」を使用すると、BFDを併用しているか否かを確認できます。

vyos@vy003:~$ show ip ospf neighbor detail 
 Neighbor 10.2.2.2, interface address 192.168.23.2
    In the area 0.0.0.0 via interface eth0
    Neighbor priority is 1, State is Init, 2 state changes
    Most recent state change statistics:
      Progressive change 0.159s ago
    DR is 192.168.23.2, BDR is 0.0.0.0
    Options 0 *|-|-|-|-|-|-|-
    Dead timer due in 29.840s
    Database Summary List 0
    Link State Request List 0
    Link State Retransmission List 0
    Thread Inactivity Timer on
    Thread Database Description Retransmision off
    Thread Link State Request Retransmission off
    Thread Link State Update Retransmission off

    BFD: Type: single hop
      Detect Multiplier: 3, Min Rx interval: 300, Min Tx interval: 300
      Status: Up, Last update: 0:00:00:03

vyos@vy003:~$ 
vyos@vy003:~$ 
vyos@vy003:~$ show ipv6 ospfv3 neighbor detail
 Neighbor 10.2.2.2%eth0
    Area 0 via interface eth0 (ifindex 2)
    His IfIndex: 3 Link-local address: fe80::250:56ff:fe8e:5ec2
    State Full for a duration of 00:58:08
    His choice of DR/BDR 10.3.3.3/10.2.2.2, Priority 1
    DbDesc status: Master SeqNum: 0x25030000
    Summary-List: 0 LSAs
    Request-List: 0 LSAs
    Retrans-List: 0 LSAs
    0 Pending LSAs for DbDesc in Time 00:00:00 [thread off]
    0 Pending LSAs for LSReq in Time 00:00:00 [thread off]
    0 Pending LSAs for LSUpdate in Time 00:00:00 [thread off]
    0 Pending LSAs for LSAck in Time 00:00:00 [thread off]
    BFD: Type: single hop
      Detect Multiplier: 3, Min Rx interval: 300, Min Tx interval: 300
      Status: Up, Last update: 0:00:00:49

vyos@vy003:~$ 

動作確認

動作確認の構成

以下の環境で動作確認を行います。

+-----------------------+
|         vy001         |
| Lo:10.1.1.1/32        |
| Lo:2001:0DB8:1::1/128 |
+-----------+-----------+
       eth0 | .1  ::1
            | 
            | 192.168.12.0/24
            | 2001:0DB8:12::/64
            | 
       eth0 | .2 ::2
+-----------+-----------+
|         vy002         |
| Lo:10.2.2.2/32        |
| Lo:2001:0DB8:2::2/128 |
+-----------+-----------+
       eth1 | .2 ::2
            | 
            | 192.168.23.0/24
            | 2001:0DB8:23::/64
            | 
       eth0 | .3 ::3
+-----------+-----------+
|         vy003         |
| Lo:10.3.3.3/32        |
| Lo:2001:0DB8:3::3/128 |
+-----------------------+

初期設定

IPv4アドレスとIPv6アドレスは付与済の状態で動作確認をします。

vy001 : VyOS 1.4
set interfaces ethernet eth0 address '192.168.12.1/24'
set interfaces ethernet eth0 address '2001:0DB8:12::1/64'
set interfaces ethernet eth0 hw-id '00:50:56:8e:74:ec'
set interfaces loopback lo address '10.1.1.1/32'
set interfaces loopback lo address '2001:0DB8:1::1/128'
set service ssh
set system config-management commit-revisions '100'
set system console device ttyS0 speed '115200'
set system host-name 'vy001'
set system login user vyos authentication encrypted-password '$6$tMjC07ln2rEuCnYQ$NrbFEUQTzGprNHwkxo5skkG5h4rX1G6RQxdpo61p3MF77PluwdJgfP9UlYT7f1Nr.gIFKoQdAsKRBykNU24.I/'
set system login user vyos authentication plaintext-password ''
set system ntp server time1.vyos.net
set system ntp server time2.vyos.net
set system ntp server time3.vyos.net
set system syslog global facility all level 'info'
set system syslog global facility protocols level 'debug'
vy002 : VyOS 1.4
set interfaces ethernet eth0 address '192.168.12.2/24'
set interfaces ethernet eth0 address '2001:0DB8:12::2/64'
set interfaces ethernet eth0 hw-id '00:50:56:8e:45:5e'
set interfaces ethernet eth1 address '192.168.23.2/24'
set interfaces ethernet eth1 address '2001:0DB8:23::2/64'
set interfaces ethernet eth1 hw-id '00:50:56:8e:5e:c2'
set interfaces loopback lo address '10.2.2.2/32'
set interfaces loopback lo address '2001:0DB8:2::2/128'
set service ssh
set system config-management commit-revisions '100'
set system console device ttyS0 speed '115200'
set system host-name 'vy002'
set system login user vyos authentication encrypted-password '$6$tMjC07ln2rEuCnYQ$NrbFEUQTzGprNHwkxo5skkG5h4rX1G6RQxdpo61p3MF77PluwdJgfP9UlYT7f1Nr.gIFKoQdAsKRBykNU24.I/'
set system login user vyos authentication plaintext-password ''
set system ntp server time1.vyos.net
set system ntp server time2.vyos.net
set system ntp server time3.vyos.net
set system syslog global facility all level 'info'
set system syslog global facility protocols level 'debug'
vy003 : VyOS 1.4
set interfaces ethernet eth0 address '192.168.23.3/24'
set interfaces ethernet eth0 address '2001:0DB8:23::3/64'
set interfaces ethernet eth0 hw-id '00:50:56:8e:01:93'
set interfaces loopback lo address '10.3.3.3/32'
set interfaces loopback lo address '2001:0DB8:3::3/128'
set service ssh
set system config-management commit-revisions '100'
set system console device ttyS0 speed '115200'
set system host-name 'vy003'
set system login user vyos authentication encrypted-password '$6$tMjC07ln2rEuCnYQ$NrbFEUQTzGprNHwkxo5skkG5h4rX1G6RQxdpo61p3MF77PluwdJgfP9UlYT7f1Nr.gIFKoQdAsKRBykNU24.I/'
set system login user vyos authentication plaintext-password ''
set system ntp server time1.vyos.net
set system ntp server time2.vyos.net
set system ntp server time3.vyos.net
set system syslog global facility all level 'info'
set system syslog global facility protocols level 'debug'

動作確認 (1) OSPF netowork type broadcast

OSPFのデフォルト設定であるnetwork typeがbroadcastである場合の動作確認をします。3台のルータにOSPF neighborの設定を入れます。

[vy001:VyOS1.4]
set protocols ospf area 0 network '192.168.12.0/24'
set protocols ospf area 0 network '10.1.1.1/32'
set protocols ospfv3 area 0 interface 'eth0'
set protocols ospfv3 area 0 interface 'lo'

[vy002:VyOS1.4]
set protocols ospf area 0 network '192.168.12.0/24'
set protocols ospf area 0 network '192.168.23.0/24'
set protocols ospf area 0 network '10.2.2.2/32'
set protocols ospfv3 area 0 interface 'eth0'
set protocols ospfv3 area 0 interface 'eth1'
set protocols ospfv3 area 0 interface 'lo'

[vy003:VyOS1.4]
set protocols ospf area 0 network '192.168.23.0/24'
set protocols ospf area 0 network '10.3.3.3/32'
set protocols ospfv3 area 0 interface 'lo'
set protocols ospfv3 area 0 interface 'eth0'

OSPF neighborが確立された事を確認します。

[vy002:VyOS1.4]
vyos@vy002:~$ show ip ospf neighbor 

Neighbor ID     Pri State           Dead Time Address         Interface                        RXmtL RqstL DBsmL
10.1.1.1          1 Full/DR           34.347s 192.168.12.1    eth0:192.168.12.2                    0     0     0
10.3.3.3          1 Full/Backup       38.539s 192.168.23.3    eth1:192.168.23.2                    0     0     0

vyos@vy002:~$ 
vyos@vy002:~$ 
vyos@vy002:~$ show ipv6 ospfv3 neighbor 
Neighbor ID     Pri    DeadTime    State/IfState         Duration I/F[State]
10.1.1.1          1    00:00:31     Full/BDR             00:03:34 eth0[DR]
10.3.3.3          1    00:00:31     Full/BDR             00:01:58 eth1[DR]
vyos@vy002:~$ 

ルーティングテーブルにOSPFのprefixが載っている事を確認します。

[vy002:VyOS1.4]
vyos@vy002:~$ show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup

O>* 10.1.1.1/32 [110/1] via 192.168.12.1, eth0, weight 1, 00:38:23
O   10.2.2.2/32 [110/0] is directly connected, lo, weight 1, 00:38:43
C>* 10.2.2.2/32 is directly connected, lo, 00:54:20
O>* 10.3.3.3/32 [110/1] via 192.168.23.3, eth1, weight 1, 00:27:41
O   192.168.12.0/24 [110/1] is directly connected, eth0, weight 1, 00:38:43
C>* 192.168.12.0/24 is directly connected, eth0, 00:54:18
O   192.168.23.0/24 [110/1] is directly connected, eth1, weight 1, 00:29:31
C>* 192.168.23.0/24 is directly connected, eth1, 00:54:19
vyos@vy002:~$ 
vyos@vy002:~$ 
vyos@vy002:~$ show ipv6 route
Codes: K - kernel route, C - connected, S - static, R - RIPng,
       O - OSPFv3, I - IS-IS, B - BGP, N - NHRP, T - Table,
       v - VNC, V - VNC-Direct, A - Babel, D - SHARP, F - PBR,
       f - OpenFabric,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup

O>* 2001:db8:1::1/128 [110/20] via fe80::250:56ff:fe8e:74ec, eth0, weight 1, 00:02:21
O   2001:db8:2::2/128 [110/10] is directly connected, lo, weight 1, 00:04:13
C>* 2001:db8:2::2/128 is directly connected, lo, 00:54:24
O>* 2001:db8:3::3/128 [110/20] via fe80::250:56ff:fe8e:193, eth1, weight 1, 00:02:38
O   2001:db8:12::/64 [110/10] is directly connected, eth0, weight 1, 00:04:19
C>* 2001:db8:12::/64 is directly connected, eth0, 00:54:20
O   2001:db8:23::/64 [110/10] is directly connected, eth1, weight 1, 00:02:43
C>* 2001:db8:23::/64 is directly connected, eth1, 00:54:21
C * fe80::/64 is directly connected, eth0, 00:54:21
C * fe80::/64 is directly connected, eth1, 00:54:21
C>* fe80::/64 is directly connected, lo, 00:54:23
vyos@vy002:~$ 

パケットキャプチャでOSPFを観察します。IPv4では224.0.0.5と、IPv6ではff02::5とマルチキャストを使用しています。パブリッククラウドやSDNはマルチキャストを苦手とするため、デフォルト設定のOSPFは近年のインフラと非常に相性が悪くなりつつあります。次のシナリオでは、マルチキャストを使用しないunicast neighborを設定します。

[vy002:VyOS1.4]
root@vy002:~# tcpdump -i eth0 ip and proto 89
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
09:58:42.800667 IP 192.168.12.1 > 224.0.0.5: OSPFv2, Hello, length 48
09:58:43.143724 IP 192.168.12.2 > 224.0.0.5: OSPFv2, Hello, length 48
09:58:52.800756 IP 192.168.12.1 > 224.0.0.5: OSPFv2, Hello, length 48
09:58:53.143711 IP 192.168.12.2 > 224.0.0.5: OSPFv2, Hello, length 48
^C
4 packets captured
4 packets received by filter
0 packets dropped by kernel
root@vy002:~# 
root@vy002:~# 
root@vy002:~# 
root@vy002:~# tcpdump -i eth0 ipv6 and proto 89
tcpdump: can't parse filter expression: syntax error
root@vy002:~# tcpdump -i eth0 ip6 and proto 89
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
09:59:06.867022 IP6 fe80::250:56ff:fe8e:455e > ff02::5: OSPFv3, Hello, length 40
09:59:07.648004 IP6 fe80::250:56ff:fe8e:74ec > ff02::5: OSPFv3, Hello, length 40
09:59:16.869418 IP6 fe80::250:56ff:fe8e:455e > ff02::5: OSPFv3, Hello, length 40
09:59:17.648087 IP6 fe80::250:56ff:fe8e:74ec > ff02::5: OSPFv3, Hello, length 40
^C
4 packets captured
4 packets received by filter
0 packets dropped by kernel
root@vy002:~# 

動作確認 (2) unicast neighbor

ユニキャストを使用してOSPF neighborを確立するには、network typeをnon-broadcastなどに変更します。

この規格が考えられていた当時は、non-broadcastは低品質・高遅延の広域網を想定していましたので、hello 180秒, dead 60秒がデフォルト設定になっています。180秒を待つのは動作確認に時間がかかってしまうので、hello, deadも短めに設定変更します。

VyOS1.4時点では、IPv6 OSPFv3はnon-broadcastに対応していないため、IPv6の動作確認は省略します。

[vy001:VyOS1.4]
set protocols ospf interface eth0 dead-interval '30'
set protocols ospf interface eth0 hello-interval '10'
set protocols ospf interface eth0 network 'non-broadcast'
set protocols ospf neighbor 192.168.12.2

[vy002:VyOS1.4]
set protocols ospf interface eth0 dead-interval '30'
set protocols ospf interface eth0 hello-interval '10'
set protocols ospf interface eth0 network 'non-broadcast'
set protocols ospf interface eth1 dead-interval '30'
set protocols ospf interface eth1 hello-interval '10'
set protocols ospf interface eth1 network 'non-broadcast'
set protocols ospf neighbor 192.168.12.1
set protocols ospf neighbor 192.168.23.3

[vy003:VyOS1.4]
set protocols ospf interface eth0 dead-interval '30'
set protocols ospf interface eth0 hello-interval '10'
set protocols ospf interface eth0 network 'non-broadcast'
set protocols ospf neighbor 192.168.23.2

OSPF neighborが確立された事を確認します。

[vy002:VyOS1.4]
vyos@vy002:~$ show ip ospf neighbor 

Neighbor ID     Pri State           Dead Time Address         Interface                        RXmtL RqstL DBsmL
10.1.1.1          1 Full/Backup       29.465s 192.168.12.1    eth0:192.168.12.2                    0     0     0
10.3.3.3          1 Full/DR           29.461s 192.168.23.3    eth1:192.168.23.2                    0     0     0

OSPFがunicastによる通信を試みている事を確認します。

[vy002:VyOS1.4]
root@vy002:~# tcpdump -i eth0 ip and proto 89
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
10:06:03.831698 IP 192.168.12.1 > 192.168.12.2: OSPFv2, Hello, length 48
10:06:08.353795 IP 192.168.12.2 > 192.168.12.1: OSPFv2, Hello, length 48
10:06:13.832010 IP 192.168.12.1 > 192.168.12.2: OSPFv2, Hello, length 48
10:06:18.354104 IP 192.168.12.2 > 192.168.12.1: OSPFv2, Hello, length 48
^C
4 packets captured
4 packets received by filter
0 packets dropped by kernel
root@vy002:~# 

動作確認 (3) BFD neighbor

BFD (Bidirectional Forwarding Detection) は双方向でトラフィックを流す事で早期の障害を検知する仕組みです。OSPF helloよりも軽量のパケットを死活監視に用いる事で、ミリ秒単位での切り替えを実現する時に使用します。

まずはvy001, vy002, vy003の間で、IPv4とIPv6のBFD neighborを確立します。

[vy001:VyOS1.4]
set protocols bfd peer 192.168.12.2 interval echo-interval '250'
set protocols bfd peer 192.168.12.2 interval multiplier '3'
set protocols bfd peer 192.168.12.2 interval transmit '60'
set protocols bfd peer 2001:0DB8:12::2 interval echo-interval '250'
set protocols bfd peer 2001:0DB8:12::2 interval multiplier '3'
set protocols bfd peer 2001:0DB8:12::2 interval transmit '60'
set protocols bfd peer 2001:0DB8:12::2 source address '2001:db8:12::1'

[vy002:VyOS1.4]
set protocols bfd peer 192.168.12.1 interval echo-interval '250'
set protocols bfd peer 192.168.12.1 interval multiplier '3'
set protocols bfd peer 192.168.12.1 interval transmit '60'
set protocols bfd peer 192.168.23.3 interval echo-interval '250'
set protocols bfd peer 192.168.23.3 interval multiplier '3'
set protocols bfd peer 192.168.23.3 interval transmit '60'
set protocols bfd peer 2001:0DB8:12::1 interval echo-interval '250'
set protocols bfd peer 2001:0DB8:12::1 interval multiplier '3'
set protocols bfd peer 2001:0DB8:12::1 interval transmit '60'
set protocols bfd peer 2001:0DB8:12::1 source address '2001:db8:12::2'
set protocols bfd peer 2001:0DB8:23::3 interval echo-interval '250'
set protocols bfd peer 2001:0DB8:23::3 interval multiplier '3'
set protocols bfd peer 2001:0DB8:23::3 interval transmit '60'
set protocols bfd peer 2001:0DB8:23::3 source address '2001:db8:23::2'

[vy003:VyOS1.4]
set protocols bfd peer 192.168.23.2 interval echo-interval '250'
set protocols bfd peer 192.168.23.2 interval multiplier '3'
set protocols bfd peer 192.168.23.2 interval transmit '60'
set protocols bfd peer 2001:0DB8:23::2 interval echo-interval '250'
set protocols bfd peer 2001:0DB8:23::2 interval multiplier '3'
set protocols bfd peer 2001:0DB8:23::2 interval transmit '60'
set protocols bfd peer 2001:0DB8:23::2 source address '2001:db8:23::3'

BFD peerが確立された事を確認します。

[vy001:VyOS1.4]
vyos@vy001:~$ show protocols bfd peer
BFD Peers:
        peer 192.168.12.2 vrf default
                ID: 545079937
                Remote ID: 2792572690
                Active mode
                Status: up
                Uptime: 7 minute(s), 48 second(s)
                Diagnostics: ok
                Remote diagnostics: ok
                Peer Type: configured
                Local timers:
                        Detect-multiplier: 3
                        Receive interval: 300ms
                        Transmission interval: 60ms
                        Echo transmission interval: 250ms
                Remote timers:
                        Detect-multiplier: 3
                        Receive interval: 300ms
                        Transmission interval: 60ms
                        Echo transmission interval: 250ms

        peer 2001:db8:12::2 local-address 2001:db8:12::1 vrf default
                ID: 96104874
                Remote ID: 3574562308
                Active mode
                Status: up
                Uptime: 2 minute(s), 54 second(s)
                Diagnostics: ok
                Remote diagnostics: ok
                Peer Type: configured
                Local timers:
                        Detect-multiplier: 3
                        Receive interval: 300ms
                        Transmission interval: 60ms
                        Echo transmission interval: 250ms
                Remote timers:
                        Detect-multiplier: 3
                        Receive interval: 300ms
                        Transmission interval: 60ms
                        Echo transmission interval: 250ms

vyos@vy001:~$ 

250ミリ秒間隔でBFDのパケットが送受信されている事が分かります。

root@vy002:~# tcpdump -i eth0 ip and udp port 3784
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
10:14:03.275710 IP 192.168.12.2.49152 > 192.168.12.1.3784: BCM-LI-SHIM: direction unused, pkt-type unknown, pkt-subtype untagged, li-id 792
10:14:03.458636 IP 192.168.12.1.49152 > 192.168.12.2.3784: BCM-LI-SHIM: direction unused, pkt-type unknown, pkt-subtype untagged, li-id 792
10:14:03.518780 IP 192.168.12.2.49152 > 192.168.12.1.3784: BCM-LI-SHIM: direction unused, pkt-type unknown, pkt-subtype untagged, li-id 792
10:14:03.686742 IP 192.168.12.1.49152 > 192.168.12.2.3784: BCM-LI-SHIM: direction unused, pkt-type unknown, pkt-subtype untagged, li-id 792
10:14:03.818861 IP 192.168.12.2.49152 > 192.168.12.1.3784: BCM-LI-SHIM: direction unused, pkt-type unknown, pkt-subtype untagged, li-id 792
10:14:03.959816 IP 192.168.12.1.49152 > 192.168.12.2.3784: BCM-LI-SHIM: direction unused, pkt-type unknown, pkt-subtype untagged, li-id 792
10:14:04.109939 IP 192.168.12.2.49152 > 192.168.12.1.3784: BCM-LI-SHIM: direction unused, pkt-type unknown, pkt-subtype untagged, li-id 792
^C
7 packets captured
7 packets received by filter
0 packets dropped by kernel
root@vy002:~# 
root@vy002:~# 
root@vy002:~# tcpdump -i eth0 ip6 and udp port 3784
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
10:15:24.553967 IP6 2001:db8:12::2.49152 > 2001:db8:12::1.3784: BCM-LI-SHIM: direction unused, pkt-type unknown, pkt-subtype untagged, li-id 792
10:15:24.615218 IP6 2001:db8:12::1.49153 > 2001:db8:12::2.3784: BFDv1, Control, State Up, Flags: [none], length: 24
10:15:24.824055 IP6 2001:db8:12::2.49152 > 2001:db8:12::1.3784: BCM-LI-SHIM: direction unused, pkt-type unknown, pkt-subtype untagged, li-id 792
10:15:24.903461 IP6 2001:db8:12::1.49153 > 2001:db8:12::2.3784: BFDv1, Control, State Up, Flags: [none], length: 24
10:15:25.076137 IP6 2001:db8:12::2.49152 > 2001:db8:12::1.3784: BCM-LI-SHIM: direction unused, pkt-type unknown, pkt-subtype untagged, li-id 792
10:15:25.188585 IP6 2001:db8:12::1.49153 > 2001:db8:12::2.3784: BFDv1, Control, State Up, Flags: [none], length: 24
10:15:25.340335 IP6 2001:db8:12::2.49152 > 2001:db8:12::1.3784: BCM-LI-SHIM: direction unused, pkt-type unknown, pkt-subtype untagged, li-id 792
^C
7 packets captured
8 packets received by filter
0 packets dropped by kernel
root@vy002:~# 

動作確認 (4) BFDとOSPFの関連付け

BFDとOSPFを関連付ける事によって、ミリ秒単位の切り替えを実現します。以下のような設定でBFDをOSPFを紐づける事ができます。

[vy001:VyOS1.4]
set protocols ospf interface eth0 bfd 
set protocols ospfv3 interface eth0 bfd 

[vy002:VyOS1.4]
set protocols ospf interface eth0 bfd 
set protocols ospfv3 interface eth0 bfd 
set protocols ospf interface eth1 bfd 
set protocols ospfv3 interface eth1 bfd 

[vy003:VyOS1.4]
set protocols ospf interface eth0 bfd 
set protocols ospfv3 interface eth0 bfd 

「show ip ospf neighbor detail」「show ipv6 ospfv3 neighbor detail」を見ると、BFDによる障害検出が有効になっている事が読み取れます。

[vy001:VyOS1.4]
vyos@vy001:~$ show ip ospf neighbor detail 
 Neighbor 10.2.2.2, interface address 192.168.12.2
    In the area 0.0.0.0 via interface eth0
    Neighbor priority is 1, State is Init, 2 state changes
    Most recent state change statistics:
      Progressive change 7.317s ago
    DR is 192.168.12.2, BDR is 192.168.12.1
    Options 0 *|-|-|-|-|-|-|-
    Dead timer due in 22.682s
    Database Summary List 0
    Link State Request List 0
    Link State Retransmission List 0
    Thread Inactivity Timer on
    Thread Database Description Retransmision off
    Thread Link State Request Retransmission off
    Thread Link State Update Retransmission off

    BFD: Type: single hop
      Detect Multiplier: 3, Min Rx interval: 300, Min Tx interval: 300
      Status: Unknown, Last update: never

vyos@vy001:~$ 
vyos@vy001:~$ 
vyos@vy001:~$ show ipv6 ospfv3 neighbor detail 
 Neighbor 10.2.2.2%eth0
    Area 0 via interface eth0 (ifindex 2)
    His IfIndex: 2 Link-local address: fe80::250:56ff:fe8e:455e
    State Full for a duration of 00:24:04
    His choice of DR/BDR 10.2.2.2/10.1.1.1, Priority 1
    DbDesc status: Slave SeqNum: 0x53000000
    Summary-List: 0 LSAs
    Request-List: 0 LSAs
    Retrans-List: 0 LSAs
    0 Pending LSAs for DbDesc in Time 00:00:00 [thread off]
    0 Pending LSAs for LSReq in Time 00:00:00 [thread off]
    0 Pending LSAs for LSUpdate in Time 00:00:00 [thread off]
    0 Pending LSAs for LSAck in Time 00:00:00 [thread off]
    BFD: Type: single hop
      Detect Multiplier: 3, Min Rx interval: 300, Min Tx interval: 300
      Status: Up, Last update: 0:00:00:16

vyos@vy001:~$ 

vy002のリンクダウン/リンクアップを、10秒以内に操作します。

[vy002:VyOS1.4]
vyos@vy002# set interfaces ethernet eth0 disable
[edit]
vyos@vy002# commit
[edit]
vyos@vy002# delete interfaces ethernet eth0 disable
[edit]
vyos@vy002# commit
[edit]
vyos@vy002# 

dead intervalが30秒なのでOSPF helloのみでは検出できない障害ですが、BFDによってOSPFが障害を検出した事を確認します。OSPF neighborのstateがInitになっている事からneighborが切断された事が読み取れます。

[vy001:VyOS1.4]
vyos@vy001:~$ show ip ospf neighbor 

Neighbor ID     Pri State           Dead Time Address         Interface                        RXmtL RqstL DBsmL
10.2.2.2          1 Init/DROther      26.257s 192.168.12.2    eth0:192.168.12.1                    0     0     0

vyos@vy001:~$ 
vyos@vy001:~$ 
vyos@vy001:~$ show ipv6 ospfv3 neighbor 
Neighbor ID     Pri    DeadTime    State/IfState         Duration I/F[State]
10.2.2.2          1    00:00:33     Init/DROther         00:00:06 eth0[DR]
vyos@vy001:~$ 
タイトルとURLをコピーしました