メモのページ - チラシの裏メモ 3枚目

通信技術や気になった事を黙々とメモし続ける

SONiCとCumulus Linuxで4byte ASなBGP + IP Clos構成

BGP unnumberedを使ってSONiCとCumulus Linux(Cumulus VX)との間でIP Clos構成を組んでみた。
前回(SONiCとCumulus LinuxでBGP/EVPN/VXLAN)と前々回(SONiCとCumulus LinuxでBGP unnumbered)では、SONiCとCumulus Linuxそれぞれ1台づつの構成だったが、IP Clos構成を組むにあたり2台だけではつまらない為、SONiCでSpine機1台、Cumulus LinuxでLeaf機2台を準備し、4バイトAS番号+BUP unnumberedでL3ルーティング構成を組んだ。


IP Clos構成とは?
データセンター内のネットワークにて採用されている構成方式で、スケールアウトが容易なLeaf-Spine構成をL3で構築する。
関連する仕様はRFC7938(Use of BGP for Routing in Large-Scale Data Centers)となっている。
IP Clos構成の元となるものは1950年代には既に提唱されており、データセンタのネットワーク構成に採用される前は、Cisco Catalyst6500シリーズスイッチのバックプレーンとしてクロスバースイッチ方式が採用される等、通信技術の分野では時々顔を出していた。
綴りは「Cross」ではなく「Clos」であり、Closネットワークを体系付けたCharles Closにちなむ。


BGP unnumberedとは?
インタフェースに設定されているIPv4なアドレスを使わずにBGPピアを張る事が出来る、BGPの設定方法。
関連する仕様はRFC5549(Advertising IPv4 Network Layer Reachability Information with an IPv6 Next Hop)となっている。
IPv6 link-localアドレスを利用し、経路情報をBGPのネクストホップ宛てにアドバタイズする事が出来るというもの。
BGP unnumberedの設定は、データセンタ内のLeaf-Spineな構成にて見かける事が有る。


当方の環境
ホストOS:Windows10 64bit版 / RAM: 8GB / CPU: Intel Core i5 M460 2.53GHz
Oracle Virtualbox:6.1.24
ゲストOS:SONiC 202106.35266-1ca6dc996
ゲストOS:Cumulus VX 4.4.0


構成
SONiCをSpine、Cumulus Linux(Cumulus VX)をLeafとする。
SONiCはデプロイ完了の時点で、IPアドレスやBGP等の設定が既に入っていた状態だった為、BGPの設定は既存から大幅に設定を修正。
Cumulus Linux側はSONiCの設定に合わせるような内容でIPアドレスとBGPを設定。
※図をクリックすると拡大表示します



SONiCおよびCumulus Linuxの導入
2021年9月6日週には、公式のダウンロードサイトはJenkinsではなくGithubになった。
https://github.com/login?client_id=1c335cda560e89889b5d

SONiCの開発者が個人で立ち上げた以下のサイトからもダウンロードが可能。
ただし、個人的に立ち上げたサイトである為、永続的にダウンロードが可能であるかに関しては不明。
https://sonic.software/
ダウンロード後、.imgファイルをNHCというツールで.vhdファイルに変換し、VBoxManage.exeコマンドでUUIDを付与する必要が有る。
SONiCのデプロイに関しては、以下の記事をご参照ください。
https://debslink.hatenadiary.jp/entry/20210131/1612091391 SONiCを少しかじってみた
Cumulus VXのデプロイに関しては、下記の動画をご参照ください。
https://www.youtube.com/watch?v=9AYYhBcDm1Q how to install Cumulus VX on Virtual Box
SONiC~Cumulus VX間を仮想的に1本づつ仮想的なケーブルで接続させるには、ネットワークアダプタの内部ネットワークの設定を変更する必要が有る。
設定変更の方法に関しては以下の記事をご参照ください。
https://debslink.hatenadiary.jp/entry/20201217/1608182777


Cumulus Linux (Cumulus VX)の設定内容
過去の記事(https://debslink.hatenadiary.jp/entry/20201206/1607231451 Virtualbox + Cumulus VXでIP Clos構成を組んでみた)の内容をほぼ踏襲。
インタフェースやシステム周りはNCLUコマンドで設定を投入し、net commitコマンドで設定内容を保存。
BGPはvtyshモードに入りCisco IOSライクなコマンドで設定を投入し、write memoryコマンドで設定内容を保存。

以下は/etc/network/interfacesファイルの内容。
Leafスイッチ1号機のinterfacesファイルだが、2号機のinterfacesファイルも同じ内容で、ホスト名とalias設定の値が異なっているだけである。
NCLUコマンドで投入したインタフェース周りの設定が書かれている。
link-speedとmtuの値はSONiCに合わせている。

# The loopback network interface
auto lo
iface lo inet loopback
    # The primary network interface
    address 10.1.1.1/32

# The primary network interface
auto eth0
iface eth0
    address 192.168.3.112/24
    vrf mgmt

auto swp1
iface swp1
    address 192.168.100.1/31
    alias DEV=jpmtkvmsw99 IF=eth0
    link-speed 40000
    mtu 9100

auto swp2
iface swp2
    address 192.168.11.1/24
    alias DEV=jpmtkvmsw00 IF=eth0
    bridge-vids 101
    link-speed 1000

auto bridge
iface bridge
    bridge-ports swp2
    bridge-vids 101
    bridge-vlan-aware yes

auto mgmt
iface mgmt
    address 127.0.0.1/8
    address ::1/128
    vrf-table auto

auto vlan101
iface vlan101
    address 192.168.11.1/24
    vlan-id 101
    vlan-raw-device bridge


以下は/etc/frr/frr.confファイルの内容。
Leafスイッチ1号機のfrr.confファイルだが、2号機のfrr.confファイルも同じ内容で、ホスト名とやAS番号やIPアドレスが異なっているだけである。
4byte ASを使用している為、AS番号は今回は10桁のものを採用。
また、BGP unnumberedにしている為、neighborコマンドのオプション値は至側のIPアドレスではなく自側のインタフェース名になっている。
vtyshモードに入り、Cisco IOSライクなコマンドで設定投入し、writeコマンドで設定内容を保存。
vtyshモードから抜けない状態でshow runコマンドを叩くと、以下が出力される。

frr version 7.5+cl4.4.0u4
frr defaults datacenter
hostname jpmtkvmsw98
log syslog informational
service integrated-vtysh-config
!
ip route 10.1.1.1/32 192.168.100.1
ip route 10.1.1.2/32 192.168.100.3
!
interface swp1
 ipv6 nd ra-interval 10
 no ipv6 nd suppress-ra
!
router bgp 4210000001
 bgp router-id 10.1.1.1
 bgp bestpath as-path multipath-relax
 neighbor FABRIC peer-group
 neighbor FABRIC remote-as external
 neighbor FABRIC bfd
 neighbor FABRIC capability extended-nexthop
 neighbor swp1 interface peer-group FABRIC
 !
 address-family ipv4 unicast
  network 10.1.1.1/32
  network 192.168.11.0/24
  redistribute connected
  neighbor swp1 default-originate
 exit-address-family
!
line vty



SONiCの設定内容
以下は/etc/sonic/config_db.jsonファイルの内容。自分の場合、直接編集した。
"BGP_NEIGHBOR"の項目について。
"asn"はBGPピア側のAS番号。
"EthernetX interface"は、元々は自側のIPアドレスが記載されていた箇所であるが、BGP unnumberedの場合はIPアドレスを削除し、インタフェース名を記載する。
"keepalive"の下に有ったBGPピア側のアドレスの設定項目"local_addr"の行は削除した。
"name"は任意の文字列に修正。自分の場合、BGPピア側のインタフェース情報を記載した。
"DEVICE_METADATA"の項目は、"bgp_asn"の値のみ修正。自側のAS番号を記載。
"INTERFACE"と"LOOPBACK_INTERFACE"の項目は、該当するインタフェースにてIPアドレスを修正。使用しないインタフェースは削除せず残している。
"MGMT_INTERFACE"の項目は、デプロイ直後にNCLUコマンドで設定した内容が反映されている。
config_db.jsonファイルの記載内容はもっと多いのだが、以下においては手を加えていない箇所は省略し載せている。

{
    "BGP_NEIGHBOR": {
        "Ethernet0 interface": {
            "asn": "4210000001",
            "holdtime": "9",
            "keepalive": "3",
            "name": "CUMULUS-01-SWP1",
            "nhopself": "0",
            "rrclient": "0"
        },
        "Ethernet4 interface": {
            "asn": "4210000002",
            "holdtime": "9",
            "keepalive": "3",
            "name": "CUMULUS-02-SWP1",
            "nhopself": "0",
            "rrclient": "0"
        }
    },
:
    },
    "DEVICE_METADATA": {
        "localhost": {
            "bgp_asn": "4210000099",
            "buffer_model": "traditional",
            "default_bgp_status": "up",
            "default_pfcwd_status": "disable",
            "hostname": "jpmtkvmsw99",
            "hwsku": "Force10-S6000",
            "mac": "52:54:00:12:34:56",
            "platform": "x86_64-kvm_x86_64-r0",
            "type": "LeafRouter"
        }
    },
:
    },
    "LOOPBACK_INTERFACE": {
        "Loopback0": {},
        "Loopback0|10.1.1.99/32": {}
    },
    "MGMT_INTERFACE": {
        "eth0|192.168.3.99/24": {
            "gwaddr": "192.168.3.1"
        }
    },
    "PORT": {
        "Ethernet0": {
            "admin_status": "up",
            "alias": "fortyGigE0/0",
            "index": "0",
            "lanes": "25,26,27,28",
            "mtu": "9100",
            "speed": "40000"
        },
        "Ethernet4": {
            "admin_status": "up",
            "alias": "fortyGigE0/4",
            "index": "1",
            "lanes": "29,30,31,32",
            "mtu": "9100",
            "speed": "40000"
        },
:


以下は、show running-configの出力内容。
Cumulus Linuxと同様にvtyshモードに入り、Cisco IOSライクなコマンドで設定投入する。
SONiCをOSごと再起動させると、show runの出力内容は設定前の状態に戻る為、再起動後はBGPとルートマップの設定を一旦削除し、下記の内容を貼り付けている。
4byte ASを使用している為、AS番号は下記の参照サイトにて紹介されていた10桁のものを採用。
また、BGP unnumberedにしている為、neighborコマンドのオプション値は至側のIPアドレスではなく自側のインタフェース名になっている。
ルートマップ設定は削除したかったのだが、削除するとshow ip bgp summaryコマンドの出力内容のState/PfxRcd欄とPfxSnt欄にて(Policy)が出力されPrefixの本数が見えなかった。よってルートマップ設定は残した。

frr version 7.5.1-sonic
frr defaults traditional
hostname jpmtkvmsw99
log syslog informational
log facility local4
agentx
no service integrated-vtysh-config
!
ip route 0.0.0.0/0 192.168.3.1 200
!
router bgp 4210000099
 bgp router-id 10.1.1.99
 bgp log-neighbor-changes
 no bgp ebgp-requires-policy
 no bgp default ipv4-unicast
 bgp graceful-restart restart-time 240
 bgp graceful-restart
 bgp graceful-restart preserve-fw-state
 bgp bestpath as-path multipath-relax
 neighbor FABRIC peer-group
 neighbor FABRIC remote-as external
 neighbor Ethernet0 interface peer-group FABRIC
 neighbor Ethernet4 interface peer-group FABRIC
 !
 address-family ipv4 unicast
  network 10.1.1.99/32
  neighbor FABRIC activate
  neighbor FABRIC soft-reconfiguration inbound
  neighbor FABRIC route-map FROM_BGP_PEER_V4 in
  neighbor FABRIC route-map TO_BGP_PEER_V4 out
  maximum-paths 64
 exit-address-family
!
ip prefix-list PL_LoopbackV4 seq 5 permit 10.1.1.99/32
!
route-map FROM_BGP_PEER_V4 permit 100
!
route-map TO_BGP_PEER_V4 permit 100
!
ip nht resolve-via-default
!
line vty
!
end



BGPテーブルの内容の確認
以下はCumulus Linux側のBGPピアの情報の確認。
ネイバの欄がBGPピアのホスト名とカッコの中に自側のインタフェース名、AS番号の欄はBGPピアが属するASの番号になっている。
Leafスイッチjpmtkvmsw01とjpmtkvmsw02、Spineスイッチjpmtkvmsw99との間でBGPメッセージの送受信数に整合性が無いのは、Leafスイッチを数回再起動させていた為。

jpmtkvmsw01# show ip bgp summary

IPv4 Unicast Summary:
BGP router identifier 10.1.1.1, local AS number 4210000001 vrf-id 0
BGP table version 5
RIB entries 9, using 1800 bytes of memory
Peers 1, using 23 KiB of memory
Peer groups 1, using 64 bytes of memory

Neighbor          V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt
jpmtkvmsw99(swp1) 4 4210000099        55        55        0    0    0 00:02:25            3        5

Total number of neighbors 1
jpmtkvmsw01#

jpmtkvmsw02# show ip bgp sum

IPv4 Unicast Summary:
BGP router identifier 10.1.1.2, local AS number 4210000002 vrf-id 0
BGP table version 6
RIB entries 9, using 1800 bytes of memory
Peers 1, using 23 KiB of memory
Peer groups 1, using 64 bytes of memory

Neighbor          V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt
jpmtkvmsw99(swp1) 4 4210000099        56        57        0    0    0 00:02:32            4        5

Total number of neighbors 1
jpmtkvmsw02#


以下はSONiC側のBGPピアの情報の確認。
SONiCでは、ネイバ欄が自側のインタフェース名、AS番号の欄は至側のAS番号になっている。
Cumulus Linux、SONiC共にshow ip bgp summaryにてBGPピアのAS番号が出力されている事から、4byte ASの設定が有効になっている事が分かる。

jpmtkvmsw99# show ip bgp summary

IPv4 Unicast Summary:
BGP router identifier 10.1.1.99, local AS number 4210000099 vrf-id 0
BGP table version 63
RIB entries 9, using 1728 bytes of memory
Peers 2, using 43 KiB of memory
Peer groups 1, using 64 bytes of memory

Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt
Ethernet0       4 4210000001       710       708        0    0    0 00:03:21            3        6
Ethernet4       4 4210000002       713       702        0    0    0 00:03:18            3        6

Total number of neighbors 2
jpmtkvmsw99#



経路情報の確認
以下は、Cumulus Linux側のルーティングテーブルの内容。
Leafスイッチのjpmtkvmsw01は、Leafスイッチjpmtkvmsw02のLAN側ネットワーク192.168.12.0/24をBGPで学習出来ている。
また、Leafスイッチのjpmtkvmsw02は、Leafスイッチjpmtkvmsw01のLAN側ネットワーク192.168.11.0/24をBGPで学習出来ている。
jpmtkvmsw01とjpmtkvmsw02との間で保持している経路の本数に差分が有る。
前回の検証時に投入した設定が削除し切れていないのだろうか。

jpmtkvmsw01# 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
       t - trapped, o - offload failure
C>* 10.1.1.1/32 is directly connected, lo, 00:04:11
B>* 10.1.1.2/32 [20/0] via 192.168.100.0, swp1, weight 1, 00:04:05
B>* 10.1.1.99/32 [20/0] via 192.168.100.0, swp1, weight 1, 00:04:08
C>* 192.168.11.0/24 is directly connected, vlan101, 00:04:11
B>* 192.168.12.0/24 [20/0] via 192.168.100.0, swp1, weight 1, 00:04:05
C>* 192.168.100.0/31 is directly connected, swp1, 00:04:11
jpmtkvmsw01#

jpmtkvmsw02# 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
       t - trapped, o - offload failure
B>* 0.0.0.0/0 [20/0] via 192.168.100.2, swp1, weight 1, 00:04:24
B   10.1.1.1/32 [20/0] via 192.168.100.2, swp1, weight 1, 00:04:24
S>* 10.1.1.1/32 [1/0] via 192.168.100.2, swp1, weight 1, 00:04:25
C>* 10.1.1.2/32 is directly connected, lo, 00:04:27
B>* 10.1.1.99/32 [20/0] via 192.168.100.2, swp1, weight 1, 00:04:24
B>* 192.168.11.0/24 [20/0] via 192.168.100.2, swp1, weight 1, 00:04:24
C>* 192.168.12.0/24 is directly connected, vlan102, 00:04:27
C>* 192.168.100.2/31 is directly connected, swp1, 00:04:27
jpmtkvmsw02#


以下は、SONiC側のルーティングテーブルの内容。
Leafスイッチにぶら下がっているネットワーク192.168.11.0/24と192.168.12.0/24と、LeafスイッチのLoopbackインタフェースのIPアドレスをBGPで学習出来ている。

jpmtkvmsw99# 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

B>* 0.0.0.0/0 [20/0] via 192.168.100.1, Ethernet0, weight 1, 00:04:47
  *                  via 192.168.100.3, Ethernet4, weight 1, 00:04:47
S   0.0.0.0/0 [200/0] via 192.168.3.1, eth0, weight 1, 00:39:22
B>* 10.1.1.1/32 [20/0] via 192.168.100.1, Ethernet0, weight 1, 00:04:50
B>* 10.1.1.2/32 [20/0] via 192.168.100.3, Ethernet4, weight 1, 00:04:47
C>* 10.1.1.99/32 is directly connected, Loopback0, 00:38:53
C>* 192.168.3.0/24 is directly connected, eth0, 00:39:24
B>* 192.168.11.0/24 [20/0] via 192.168.100.1, Ethernet0, weight 1, 00:04:50
B>* 192.168.12.0/24 [20/0] via 192.168.100.3, Ethernet4, weight 1, 00:04:47
C>* 192.168.100.0/31 is directly connected, Ethernet0, 00:38:57
C>* 192.168.100.2/31 is directly connected, Ethernet4, 00:38:54
jpmtkvmsw99#



今回はここまで。
SONiC~Cumulus VX間で、IP Clos構成で4byte ASを使用しBGP unnumberedでBGPピアを張る事が出来た。
過去の記事に記載した設定内容を使いまわす事が出来た為、検証に要する時間は左程長くはなかった。
SONiCとCumulus Linux共に2台づつの構成にしたかったが、ホスト機のPCの排熱ファンが高速回転しPCの電源が落ちるという事象が数回発生した為、仕方なくSONiCが1台Cumulus Linuxが2台という構成となった。


AT「毎週金曜日の23:00に、YouTubeでサンライズが装甲騎兵ボトムズを1話づつ動画を配信してるぞ」
亀「むせるから、どいてくれないか?」

参考書Cloud Native Data Center Networking (Dinesh著、O'Reilly刊)の19ページ目以降に、IP Closネットワークに関する記載が有る。
ちなみに、ボトムズは当記事の編集時には第17話(クメン編)が公開されていた。


参照サイト
開発者および先達の皆さまに感謝。
https://datatracker.ietf.org/doc/html/rfc7938 Use of BGP for Routing in Large-Scale Data Centers
https://datatracker.ietf.org/doc/html/rfc5549 Advertising IPv4 Network Layer Reachability Information with an IPv6 Next Hop
https://www.networkworld.com/article/2226122/clos-networks-what-s-old-is-new-again.html Clos Networks: What's Old Is New Again
https://foobaron.hatenablog.com/entry/bgp-in-the-data-center-03 BGP in the Data Centerを読みました (3/6) : Chapter 3 - Building an Automatable BGP Configuration
https://foobaron.hatenablog.com/entry/bgp-in-the-data-center-05 BGP in the Data Centerを読みました (5/6) : Chapter 5 - BGP Life Cycle Management
https://debslink.hatenadiary.jp/entry/20201206/1607231451 Virtualbox + Cumulus VXでIP Clos構成を組んでみた
https://www.apresiatac.jp/blog/20190311992/ Cumulus LinuxでIP CLOS構築


SONiCとCumulus Linuxに関する過去の記事
https://debslink.hatenadiary.jp/entry/20210131/1612091391 SONiCを少しかじってみた
https://debslink.hatenadiary.jp/entry/20210214/1613279732 SONiCのWarm Bootの動作確認
https://debslink.hatenadiary.jp/entry/20210320/1616230057 Cumulus LinuxとSONiCの設定ファイル
https://debslink.hatenadiary.jp/entry/20210822/1629600666 SONiCとCumulus LinuxでBGP unnumbered
https://debslink.hatenadiary.jp/entry/20210902/1630584311 SONiCとCumulus LinuxでBGP/EVPN/VXLAN
https://debslink.hatenadiary.jp/entry/20201206/1607231451 Virtualbox + Cumulus VXでIP Clos構成を組んでみた
https://debslink.hatenadiary.jp/entry/20220122/1642852049 SONiCでL2 MC-LAGを組んでみた