kakkotetsu

4-byte AS の SNMP MIB 対応状況 (201904)

やること

JANOG20(2007.07.12) / 4-byte AS の世界へようこそ のスライド 45 で以下のように書かれています。

MIB関連  
  
■現状,最新のMIBは,RFC4273:Definitions of  
  Managed Objects for BGP-4 )  
    □AS関係は,Inteter32 として規定されているが,  
      bgpLocalAs OBJECT-TYPE  
      SYNTAX Integer32 (0..65535)  
    なっており,改訂が必要.  
    □draft-ietf-idr-bgp4-mibv2 に取り込まれる方向  
    で議論が進行中  
      □が,現在,このドラフトはExpire状態  

この状況が 12 年経った 2019/04 になっても変わっていなかった、というのを思い知ったので、その調査(ほぼ机上)を書き残したメモです。
「2019 年にもなって SNMP についてウダウダ言ってんじゃないよ!」と殴りかかるのは止めて下さい。

調査のきっかけ

ある日、4-byte Private AS(4200000001) を設定したネットワークスイッチ(仮想)を弄っていて

$ snmpwalk -v 2c -c <COMMUNITY_STRING> tor000b .1.3.6.1.2.1.15 | more
BGP4-MIB::bgpVersion.0 = Hex-STRING: 10
BGP4-MIB::bgpLocalAs.0 = INTEGER: -94967295
BGP4-MIB::bgpIdentifier.0 = IpAddress: 172.31.0.1
BGP4-MIB::bgp4PathAttrPeer.172.16.0.0.16.172.30.128.1 = IpAddress: 172.30.128.1
BGP4-MIB::bgp4PathAttrPeer.172.16.0.0.16.172.30.128.3 = IpAddress: 172.30.128.3
BGP4-MIB::bgp4PathAttrPeer.172.16.0.0.16.172.30.128.5 = IpAddress: 172.30.128.5
BGP4-MIB::bgp4PathAttrPeer.172.17.0.0.16.172.30.128.1 = IpAddress: 172.30.128.1
BGP4-MIB::bgp4PathAttrPeer.172.17.0.0.16.172.30.128.3 = IpAddress: 172.30.128.3
BGP4-MIB::bgp4PathAttrPeer.172.17.0.0.16.172.30.128.5 = IpAddress: 172.30.128.5

...snip

BGP4-MIB を舐めていたら BGP4-MIB::bgpLocalAs.0 = INTEGER: -94967295 という Overflow に出くわしました。
別にこれを SNMP でとりたいという強い想いは全くないのですが。
4-byte AS に MIB が未対応なんだろなあ...、いや今 2019 年だぞ??って少し気になって調べることに。

調査

JANOG20(2007.07.12) スライド / 4-byte AS の世界へようこそ

まず雑にググっていたら冒頭のスライド JANOG20(2007.07.12) / 4-byte AS の世界へようこそ が目に入りました。
でも今 2019 だぞ??(しつこい)

RFC4273 Definitions of Managed Objects for BGP-4

最初に突いた BGP4-MIB の定義をしている RFC4273 / Definitions of Managed Objects for BGP-4 を参照しました。
これは RFC1657 / Definitions of Managed Objects for the Fourth Version of the Border Gateway Protocol (BGP-4) using SMIv2 を Obsoletes しているやつ。

        bgpLocalAs OBJECT-TYPE

            SYNTAX     Integer32 (0..65535)
            MAX-ACCESS read-only
            STATUS     current
            DESCRIPTION
                    "The local autonomous system number."
            REFERENCE
                     "RFC 4271, Section 4.2, 'My Autonomous System'."
            ::= { bgp 2 }

        -- BGP Peer table.  This table contains, one entry per
        -- BGP peer, information about the BGP peer.

Integer32 (0..65535)...のままなんですが!!!

draft-ietf-idr-bgp4-mibv2

冒頭のスライドでは「draft-ietf-idr-bgp4-mibv2 に取り込まれる方向で議論が進行中(が,現在,このドラフトはExpire状態)」と書かれていたもので、見に行ってみると...
Tracker / draft-ietf-idr-bgp4-mibv2 ...はい、確かに Expire 状態です。

draft-ietf-idr-bgp4-mibv2 / 7. Definitions で AS Number 周りの情報を見ると

BGP4V2-MIB DEFINITIONS ::= BEGIN

    IMPORTS

        MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE,
        mib-2, Counter32, Gauge32, Unsigned32
            FROM SNMPv2-SMI
        InetAddressType, InetAddress, InetPortNumber,
        InetAutonomousSystemNumber, InetAddressPrefixLength
            FROM INET-ADDRESS-MIB

...snip

と、AS Number の型定義は INET-ADDRESS-MIB から引っ張ってきていて。
それが定義されている RFC4001 / Textual Conventions for Internet Network Addresses を見ると

InetAutonomousSystemNumber ::= TEXTUAL-CONVENTION
    DISPLAY-HINT "d"
    STATUS       current
    DESCRIPTION
        "Represents an autonomous system number that identifies an
         Autonomous System (AS).  An AS is a set of routers under a
         single technical administration, using an interior gateway
         protocol and common metrics to route packets within the AS,
         and using an exterior gateway protocol to route packets to
         other ASes'.  IANA maintains the AS number space and has
         delegated large parts to the regional registries.

         Autonomous system numbers are currently limited to 16 bits
         (0..65535).  There is, however, work in progress to enlarge the
         autonomous system number space to 32 bits.  Therefore, this
         textual convention uses an Unsigned32 value without a
         range restriction in order to support a larger autonomous
         system number space."
    REFERENCE   "RFC 1771, RFC 1930"
    SYNTAX       Unsigned32

これは将来的な拡張のために...という理由と共に Unsigned32 と定義されております。
なので draft-ietf-idr-bgp4-mibv2 に基づいた実装ならば、4-byte AS Welcome なんでしょー。

Network OS の Private MIB

いわゆる大手メーカ NW 機器では Private MIB でどうにかしてるんだろーなーってことで、軽く見てみます。

一例 Juniper

Juniper の場合には Private MIB の BGP4-V2-MIB-JUNIPER (mib-jnx-bgpmib2)

以下のように 4-byte AS を使えるように定義しています。
REFERENCE として draft-ietf-idr-as4bytes-04 ...のちの RFC6793 / BGP Support for Four-Octet Autonomous System (AS) Number Space を明言してます。

    jnxBgpM2AsSize OBJECT-TYPE
        SYNTAX     INTEGER {
            twoOctet(1),
            fourOctet(2)
        }
        MAX-ACCESS read-only
        STATUS     current
        DESCRIPTION
            "The size of the AS value in this implementation.

             The semantics of this are determined as per the
             as-4bytes draft."
        REFERENCE
            "draft-ietf-idr-as4bytes-04"
        ::= { jnxBgpM2BaseScalars 4 }


    jnxBgpM2LocalAs OBJECT-TYPE
        SYNTAX     InetAutonomousSystemNumber
        MAX-ACCESS read-only
        STATUS     current
        DESCRIPTION
            "The local autonomous system number.

             If the jnxBgpM2AsSize is twoOctet, then the range is
             constrained to be 0-65535."
        ::= { jnxBgpM2BaseScalars 5 }

一例 Arista

Arista の場合には Private MIB の ARISTA-BGP4V2-MIB で 4-byte AS を使えるように定義しています。

まず冒頭に extracted from draft-ietf-idr-bgp4-mibv2-13.txt (例の Expire しているやつで Author は Juniper の人) と書いてあります。

-- extracted from draft-ietf-idr-bgp4-mibv2-13.txt
-- at Tue Mar 13 06:12:27 2012

具体的に AS Number についての定義を見ると

ARISTA-BGP4V2-MIB DEFINITIONS ::= BEGIN

    IMPORTS
        MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE,
        Counter32, Gauge32, Unsigned32
            FROM SNMPv2-SMI
        InetAddressType, InetAddress, InetPortNumber,
        InetAutonomousSystemNumber, InetAddressPrefixLength
            FROM INET-ADDRESS-MIB

...snip

    aristaBgp4V2PeerLocalAs OBJECT-TYPE
        SYNTAX     InetAutonomousSystemNumber
        MAX-ACCESS read-only
        STATUS     current
        DESCRIPTION
            "Some implementations of BGP can represent themselves
             as multiple ASes. This is the AS that this peering
             session is representing itself as to the remote peer."
        ::= { aristaBgp4V2PeerEntry 7 }

てな具合に AS 番号の定義は INET-ADDRESS-MIB から持ってきているよーで、
これは draft-ietf-idr-bgp4-mibv2 の項で追った通り RFC4001 / Textual Conventions for Internet Network Addresses にて Unsigned32 で定義されております。

一例 Cumulus Linux

Cumulus Linux / Supported MIBs を見ると、BGP 周りの Private MIB は無さそうです。

少し脇に反れますが Cumulus Linux / Enable SNMP Support for FRRouting を眺めると...

At this time, SNMP does not support monitoring BGP unnumbered neighbors.

ってことで「4-byte AS 番号を使って FRRouting 同士は Unnumberd 設定にして......」なんていうことをしようとすると、実質 SNMP は使えたもんじゃなさそうです。
実際冒頭で試した target は Cumulus VX だったのですが、確かに「Unnumberd な Peer 情報はとれず、Local AS Number は Overflow」って状況でした。

ちなみに Cumulus Linux の Community Slack でこの話をしたら、Cumulus Linux SE の人から以下のように返信が。うーーん、ごもっとも。

That is one of the problems with the BGP (and others) snmp MIBs that they don’t support new standards.
Personally I always advice to look at a different solution then SNMP.

OpenConfig YANG Model

現代の SNMP MIB と言っても過言ではない(貶しているわけじゃないです、念のため) OpenConfig の YANG Model だと openconfig-inet-types.yang / typedef as-number

  typedef as-number {
    type uint32;
    description
      "A numeric identifier for an autonomous system (AS). An AS is a
      single domain, under common administrative control, which forms
      a unit of routing policy. Autonomous systems can be assigned a
      2-byte identifier, or a 4-byte identifier which may have public
      or private scope. Private ASNs are assigned from dedicated
      ranges. Public ASNs are assigned from ranges allocated by IANA
      to the regional internet registries (RIRs).";
    reference
      "RFC 1930 Guidelines for creation, selection, and registration
                of an Autonomous System (AS)
       RFC 4271 A Border Gateway Protocol 4 (BGP-4)";
  }

はい、流石に 4-byte AS 対応しているっぽいですねー。

おしまい

  • SNMP MIB なんて、この件に限らずこんな感じですよねー
  • OpenConfig の YANG Model だって "Standard(?) + メーカの Private" っていう大枠の仕組みは一緒だし、同じようなことは起き(てい)る/起きていくんでしょうね...
  • ...2019年にもなって改めて語るような内容でもなかったわ(完)