【ネットワーク】BGP Unnumbered(RFC5549・8950)について

  • URLをコピーしました!
目次

はじめに

こんにちは。ネットワークエンジニアの「だいまる」です。

今回の記事では「BGP Unnumbered」について、少し勉強したのでまとめていきたいと思います。

BGP Unnumberedとは?

まず、はじめに「BGP Unnumbered」について説明していきます。

BGP Unnumberedとは「ルータのインタフェースにアドレスを割り当てずにBGPピアをUPさせる」機能です。

通常、BGPピアを設定する場合は「ルータのインタフェースにアドレスを割り当て、BGPネイバの設定を追加」します。

この時、BGPネイバの設定には「IPアドレス」を指定します。

一方、BGP Unnumberedでは「ルータのインタフェースにもBGPネイバにもIPアドレスを設定は不要」となります。(以下の図はイメージ図です)

Router1
Router1
Router2
Router2
interface Ethernet 1
 ip address 10.1.0.1

router bgp 65001
 neighbor 10.1.0.2
   remote-as 65001
   update-source ethernet 1
interface Ethernet 1…
アドレス割当あり
(通常時のBGP設定)
アドレス割当あり (通常時のBGP設定)
interface Ethernet 1
 ip address 10.1.0.2

router bgp 65001
 neighbor 10.1.0.1
   remote-as 65001
   update-source ethernet 1
interface Ethernet 1…
Router1
Router1
Router2
Router2
interface Ethernet 1
 ipv6 address use-link-local-only

router bgp 65001
 neighbor Ethernet1
   remote-as 65001
interface Ethernet 1…
アドレス割当あり
(通常時のBGP設定)
アドレス割当あり (通常時のBGP設定)
interface Ethernet 1
 ipv6 address use-link-local-only

router bgp 65001
 neighbor Ethernet1
   remote-as 65001
interface Ethernet 1…
Text is not SVG – cannot display

よくBGP Unnumberedでは「RFC5549」と呼ばれることが多いですが、「BGP Unnumbered」と「RFC5549」は別物になるようです。

RFC5549はあくまで「BGPのIPv4 Prefixに対するNexthopをIPv6に指定する機能」を定義したものになります。

ちなみにRFC5549は廃版となっており、RFC8950が最新版となっております。

220822_abema_VAUNDY

RFC5549/8950のまとめ

前章でも触れた通り、RFC5549は廃版となっており、RFC8950が最新版のため、今回はRFC8950を簡単にまとめていきたいと思います。

IPv4やIPv6の判断は「Address Family Identifier(AFI)」と「Subsequent Address Family Identifier(SAFI)」の2つで区別しています。

この値はIANAにより定義されているため、公式HPから確認することができます。

AFIの定義を見るとIPv4は「1」IPv6は「2」になっています。

<AFI/SAFI>が<1/128>と<1/129>の組み合わせがRFC5549とRFC8950で変更になりました。

変更内容は以下の通りです。

  • <1/128>と<1/129>の組み合わせ
    • 変更点:Nexthop Lengthが16 or 32 Bytesから24 or 48 Byteに変更
    • 変更内容:VPN-IPv6にも対応するため
    • 理由:既存のAFI/SAFIの定義に合わせるため

また、従来のMP-BGPではAFIが1の属性はIPv4プロトコルのみの広報となっていたが、このRFCによりNexthopのAddress FamilyにIPv6が追加されることでBGP Unnumberedの実装にもつながっています。

具体的にIPv4のAddress familyにおけるAFI/SAFIの拡張されたフィールドの定義は以下の通りです。

  • 【具体例1】
    • AFI:1
    • SAFI:1 / 2 /4
    • Nexthop Length:16 Bytes or 32 Bytes
    • Nexthop Address:IPv6 (Link-Local含む)
    • NLRI:AFI/SAFIの定義次第
  • 【具体例2】
    • AFI:1
    • SAFI:128 / 129
    • Nexthop Length:24 Bytes or 48 Bytes
    • Nexthop Address:VPN-IPv6
    • NLRI:AFI/SAFIの定義次第

上記による変更後、IPv4とIPv6の判別はNexthop Lengthで行うようです。

Address FamilyがIPv4の拡張がされた上で、BGPによる経路広報はCapabilityを利用して行います。

Capabilityの定義は以下の通りです。

  • Capability Code:5(拡張版のAFI/SAFI定義を利用)
  • Length:可変値
  • フィールド定義

RFCを簡単にまとめてみました。

次は上記の動作を確認するために実機で設定とパケットキャプチャを実施していきます。

実際にBGP Unnumberedを設定してみよう

今回の動作確認はCisco Nexus OS(NX-OS)で行いました。

また、検証構成は単純にはなりますが、以下の通りとなります。

Router3
Router3
Router1
Router1
Eth1/2
Eth1/2
Eth1/2
Eth1/2
Loopback 0
10.3.0.1/32
2400:3000:1:1::1/128
Loopback 0…
Loopback 0
10.2.0.1/32
2400:2000:1:1::1/128
Loopback 0…
Text is not SVG – cannot display

BGP Uunumbered設定時の動作

今回の設定では「ipv6 address use-link-local-only」でUnnumberedを設定しています。

その上でBGP配下の設定に「neighbor (インターフェース名)」で設定しています。

Router1の設定

interface Ethernet1/2
  no switchport
  speed 1000
  ip forward
  ipv6 address use-link-local-only
  ipv6 link-local use-bia
  ipv6 nd ra-interval 4 min 3
  ipv6 nd ra-lifetime 10
  no shutdown

router bgp 65000
  bestpath as-path multipath-relax
  address-family ipv4 unicast
    network 10.2.0.1/32
  address-family ipv6 unicast
    network 2400:2000:1:1::1/128
  neighbor Ethernet1/3
    remote-as 65001
    address-family ipv4 unicast
    address-family ipv6 unicast

Router3の設定

interface Ethernet1/2
  no switchport
  speed 1000
  ip forward
  ipv6 address use-link-local-only
  ipv6 link-local use-bia
  ipv6 nd ra-interval 4 min 3
  ipv6 nd ra-lifetime 10
  no shutdown

router bgp 65002
  address-family ipv4 unicast
    network 10.3.0.1/32
  address-family ipv6 unicast
    network 2400:3000:1:1::1/128
  neighbor Ethernet1/2
    remote-as 65000
    address-family ipv4 unicast
    address-family ipv6 unicast

BGPピア Up/Downの前後を確認

BGPピア Down時の状態確認のログは以下の通りとなっています。

ROuter3# show int status
--------------------------------------------------------------------------------
Port          Name               Status    Vlan      Duplex  Speed   Type
--------------------------------------------------------------------------------
Eth1/1        --                 notconnec 1         auto    auto    10g
Eth1/2        --                 disabled  routed    auto    1000    10g

ROuter3# show ipv6 bgp summary
BGP summary information for VRF default, address family IPv6 Unicast
BGP router identifier 10.3.0.1, local AS number 65002
BGP table version is 4, IPv6 Unicast config peers 1, capable peers 0
1 network entries and 1 paths using 256 bytes of memory
BGP attribute entries [1/172], BGP AS path entries [0/0]
BGP community entries [0/0], BGP clusterlist entries [0/0]

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
ROuter3# show ip bgp summary
BGP summary information for VRF default, address family IPv4 Unicast
BGP router identifier 10.3.0.1, local AS number 65002
BGP table version is 3, IPv4 Unicast config peers 1, capable peers 0
1 network entries and 1 paths using 244 bytes of memory
BGP attribute entries [1/172], BGP AS path entries [0/0]
BGP community entries [0/0], BGP clusterlist entries [0/0]

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
ROuter3#

設定変更後の状態ではしっかりBGPがUPしており、IFによるネイバであることがわかります。

ROuter3# show int status
--------------------------------------------------------------------------------
Port          Name               Status    Vlan      Duplex  Speed   Type
--------------------------------------------------------------------------------
Eth1/1        --                 notconnec 1         auto    auto    10g
Eth1/2        --                 connected routed    full    1000    10g

ROuter3# show ip bgp summary
BGP summary information for VRF default, address family IPv4 Unicast
BGP router identifier 10.3.0.1, local AS number 65002
BGP table version is 5, IPv4 Unicast config peers 1, capable peers 1
2 network entries and 2 paths using 488 bytes of memory
BGP attribute entries [2/344], BGP AS path entries [1/6]
BGP community entries [0/0], BGP clusterlist entries [0/0]

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
fe80::5201:ff:fe00:102%Ethernet1/2
                4 65000      11       9        5    0    0 00:00:18 1
ROuter3# show ipv6 bgp summary
BGP summary information for VRF default, address family IPv6 Unicast
BGP router identifier 10.3.0.1, local AS number 65002
BGP table version is 6, IPv6 Unicast config peers 1, capable peers 1
2 network entries and 2 paths using 512 bytes of memory
BGP attribute entries [2/344], BGP AS path entries [1/6]
BGP community entries [0/0], BGP clusterlist entries [0/0]

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
fe80::5201:ff:fe00:102%Ethernet1/2
                4 65000      11       9        6    0    0 00:00:22 1
ROuter3# show ip bgp
BGP routing table information for VRF default, address family IPv4 Unicast
BGP table version is 5, Local Router ID is 10.3.0.1
Status: s-suppressed, x-deleted, S-stale, d-dampened, h-history, *-valid, >-best
Path type: i-internal, e-external, c-confed, l-local, a-aggregate, r-redist, I-injected
Origin codes: i - IGP, e - EGP, ? - incomplete, | - multipath, & - backup, 2 - best2

   Network            Next Hop            Metric     LocPrf     Weight Path
*>e10.2.0.1/32        fe80::5201:ff:fe00:102
                                                                     0 65000 i
*>l10.3.0.1/32        0.0.0.0                           100      32768 i

ROuter3# show ipv6 bgp
BGP routing table information for VRF default, address family IPv6 Unicast
BGP table version is 6, Local Router ID is 10.3.0.1
Status: s-suppressed, x-deleted, S-stale, d-dampened, h-history, *-valid, >-best
Path type: i-internal, e-external, c-confed, l-local, a-aggregate, r-redist, I-injected
Origin codes: i - IGP, e - EGP, ? - incomplete, | - multipath, & - backup, 2 - best2

   Network            Next Hop            Metric     LocPrf     Weight Path
*>e2400:2000:1:1::1/128
                      fe80::5201:ff:fe00:102
                                                                     0 65000 i
*>l2400:3000:1:1::1/128
                      0::                               100      32768 i

また、「show ip bgp」で確認すると、IPv4 PrefixのNext HopがIPv6になっていることがわかります。

そして、BGPピア UP時に流れたパケットの中にRFC通りになっている確認を取ることができました。

赤枠の中を確認すると「Type Codeが5となっており、<AFI/SAFI>が<1/1>、Nexthop AFIがIPv6を示す「2」になっています。

また、BGP UPDATEメッセージ内部を確認すると「10.3.0.1」向けのNexthopがLink-Localアドレスになっていることがわかります。

最後に

BGP Unnumberedを今回は勉強してみました。

次回のネットワークに関する記事も勉強したことを積極的にアウトプットしていきたいと思います。

Hulu
  • URLをコピーしました!

この記事を書いた人

目次