ネットワーク構成

図 IPv6 BGP ネットワーク構成
図 IPv6 BGP ネットワーク構成

設定条件

  • AS65123とAS65004でBGPによってルートを交換して、2001:123:123:2::/64と2001:4:4:4::/64間で通信できるようにします。R2で2001:123:123:2::/64をBGPルートとして生成し、R4で2001:4:4:4::/64をBGPルートとして生成します。
  • BGPネイバーではIPv4プレフィクスを扱わないものとします。
  • 各ルータのBGPルータIDは「x.x.x.x」(x=ルータ番号)とします。
  • AS65123のIBGPネイバーはR2をルートリフレクタとして設定します。また、Loopback0のIPv6アドレスでネイバーを確立します。
  • AS65123とAS65004のEBGPネイバーはリンクローカルアドレスを利用して確立します。

初期設定

R1~R4の初期設定の抜粋は以下のとおりです。

R1

ipv6 unicast-routing
!
interface Loopback0
ipv6 address 2001:123:1:1::1/64
ipv6 address FE80::1 link-local
ipv6 ospf 1 area 0
!
interface Ethernet0/0
ipv6 address 2001:123:123:12::1/64
ipv6 address FE80::1 link-local
ipv6 ospf 1 area 0
!
interface Ethernet0/1
 ipv6 address 2001:123:123:13::1/64
 ipv6 address FE80::1 link-local
 ipv6 ospf 1 area 0
!
interface Ethernet0/2
 ipv6 address 2001:14:14:14::1/64
 ipv6 address FE80::1 link-local
!
ipv6 router ospf 1
 router-id 1.1.1.1
 log-adjacency-changes

R2

ipv6 unicast-routing
!
interface Loopback0
 ipv6 address 2001:123:2:2::2/64
 ipv6 address FE80::2 link-local
 ipv6 ospf 1 area 0
!
interface Loopback1
 ipv6 address 2001:123:123:2::2/64
 ipv6 address FE80::2 link-local
!
interface Ethernet0/0
 ipv6 address 2001:123:123:12::2/64
 ipv6 address FE80::2 link-local
 ipv6 ospf 1 area 0
!
interface Ethernet0/1
 ipv6 address 2001:123:123:23::2/64
 ipv6 address FE80::2 link-local
 ipv6 ospf 1 area 0
!
ipv6 router ospf 1
 router-id 2.2.2.2
 log-adjacency-changes

R3

ipv6 unicast-routing
!
interface Loopback0
 ipv6 address 2001:123:3:3::3/64
 ipv6 address FE80::3 link-local
 ipv6 ospf 1 area 0
!
interface Ethernet0/0
 ipv6 address 2001:123:123:23::3/64
 ipv6 address FE80::3 link-local
 ipv6 ospf 1 area 0
!
interface Ethernet0/1
 ipv6 address 2001:123:123:13::3/64
 ipv6 address FE80::3 link-local
 ipv6 ospf 1 area 0
!
interface Ethernet0/2
 ipv6 address 2001:34:34:34::3/64
 ipv6 address FE80::3 link-local
!
ipv6 router ospf 1
 router-id 3.3.3.3
 log-adjacency-changes

R4

ipv6 unicast-routing
!
interface Loopback0
 ipv6 address 2001:4:4:4::4/64
 ipv6 address FE80::4 link-local
!
interface Ethernet0/0
 ipv6 address 2001:14:14:14::4/64
 ipv6 address FE80::4 link-local
!
interface Ethernet0/1
 ipv6 address 2001:34:34:34::4/64
 ipv6 address FE80::4 link-local

設定と確認

【Step1:BGPプロセスの有効化】

R1~R4でAS番号を指定してBGPプロセスを有効化します。BGPプロセスが動作するためにはBGPルータIDが必要です。デフォルトでは、BGPルータIDはOSPFと同様にルータのIPv4アドレスをもとに決められます。R1~R4はIPv4アドレスを持たないため、BGPルータIDを決められなくなってしまいます。そこで、BGPプロセスを動作させるために、R1~R4でBGPルータIDをスタティックに設定します。次の表に、各ルータのAS番号とルータIDをまとめています。

ルータAS番号ルータID
R1651231.1.1.1
R2651232.2.2.2
R3651233.3.3.3
R4650044.4.4.4
表 AS番号とルータID

R1

router bgp 65123
 bgp router-id 1.1.1.1
 no bgp default ipv4-unicast

R2

router bgp 65123
 bgp router-id 2.2.2.2
 no bgp default ipv4-unicast

R3

router bgp 65123
 bgp router-id 3.3.3.3
 no bgp default ipv4-unicast

R4

router bgp 65004
 bgp router-id 4.4.4.4
 no bgp default ipv4-unicast

【Step2:AS65123のIBGPネイバーの設定】

AS65123のR1~R3でIBGPネイバーを設定します。IBGPネイバーはLoopback0のIPv6アドレス 2001:123:123:X:X::X (X=ルータ番号)を利用します。さらに、R2をルートリフレクタにします。router bgp直下でネイバーを指定し、IPv6プレフィクスを扱えるようにaddress-family ipv6の中でネイバーをactivateします。R1、R3はIBGPネイバーとしてルートリフレクタであるR2だけを設定します。そして、ルートリフレクタとなるR2で、R1とR3をルートリフレクタクライアントとして設定します。ルートリフレクタクライアントの設定はaddress-family ipv6の中でneighbor route-reflector-clientコマンドを利用します。

R1

router bgp 65123
 neighbor 2001:123:2:2::2 remote-as 65123
 neighbor 2001:123:2:2::2 update-source Loopback0
!
 address-family ipv6
  neighbor 2001:123:2:2::2 activate
  neighbor 2001:123:3:3::3 activate

R2

router bgp 65123
 neighbor 2001:123:1:1::1 remote-as 65123
 neighbor 2001:123:1:1::1 update-source Loopback0
 neighbor 2001:123:3:3::3 remote-as 65123
 neighbor 2001:123:3:3::3 update-source Loopback0
 !
 address-family ipv6
  neighbor 2001:123:1:1::1 activate
  neighbor 2001:123:1:1::1 route-reflector-client
  neighbor 2001:123:3:3::3 activate
  neighbor 2001:123:3:3::3 route-reflector-client

R3

router bgp 65123
 neighbor 2001:123:2:2::2 remote-as 65123
 neighbor 2001:123:2:2::2 update-source Loopback0
 !
 address-family ipv6
  neighbor 2001:123:2:2::2 activate

【Step3:AS65123のIBGPネイバーの確認】

R1~R3間のIBGPネイバーを確認します。そのために、以下のコマンドを実行します。

  • show bgp ipv6 unicast summary
  • show bgp ipv6 unicast neighbor

R2

R2#show bgp ipv6 unicast summary 
BGP router identifier 2.2.2.2, local AS number 65123
BGP table version is 1, main routing table version 1

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
2001:123:1:1::1 4 65123       2       2        0    0    0 00:00:27        0
2001:123:3:3::3 4 65123       2       2        0    0    0 00:00:14        0
R2#show bgp ipv6 unicast neighbors 
BGP neighbor is 2001:123:1:1::1,  remote AS 65123, internal link
  BGP version 4, remote router ID 1.1.1.1
  BGP state = Established, up for 00:00:32
  Last read 00:00:02, last write 00:00:02, hold time is 180, keepalive interval is 60 seconds
  Neighbor capabilities:
    Route refresh: advertised and received(old & new)
    Address family IPv6 Unicast: advertised and received
  Message statistics:
    InQ depth is 0
    OutQ depth is 0
                         Sent       Rcvd
    Opens:                  1          1
    Notifications:          0          0
    Updates:                0          0
    Keepalives:             2          2
    Route Refresh:          0          0
    Total:                  3          3
  Default minimum time between advertisement runs is 0 seconds

 For address family: IPv6 Unicast
  BGP table version 1, neighbor version 0/0
 Output queue size : 0
  Index 1, Offset 0, Mask 0x2
  Route-Reflector Client
  1 update-group member
~省略~
          
BGP neighbor is 2001:123:3:3::3,  remote AS 65123, internal link
  BGP version 4, remote router ID 3.3.3.3
  BGP state = Established, up for 00:00:21
  Last read 00:00:21, last write 00:00:21, hold time is 180, keepalive interval is 60 seconds
  Neighbor capabilities:
    Route refresh: advertised and received(old & new)
    Address family IPv6 Unicast: advertised and received
  Message statistics:
    InQ depth is 0
    OutQ depth is 0
                         Sent       Rcvd
    Opens:                  1          1
    Notifications:          0          0
    Updates:                0          0
    Keepalives:             1          1
    Route Refresh:          0          0
    Total:                  2          2
  Default minimum time between advertisement runs is 0 seconds

 For address family: IPv6 Unicast
  BGP table version 1, neighbor version 0/0
 Output queue size : 0
  Index 1, Offset 0, Mask 0x2
  Route-Reflector Client
  1 update-group member
~省略~

次の図は、AS65123のIBGPネイバーをまとめたものです。

図 AS65123のIBGPネイバー
図 AS65123のIBGPネイバー

【Step4:BGPプレフィクスの生成(AS65123)】

AS65123のR2でIPv6 BGPプレフィクス 2001:123:123:2::/64を生成します。R2でaddress-family ipv6の中でnetworkコマンドを利用します。

R2

router bgp 65123
 address-family ipv6
  network 2001:123:123:2::/64

networkコマンドで生成したIPv6 BGPプレフィクスはIBGPネイバーへとアドバタイズされます。

【Step5:AS65123内でのBGPプレフィクスアドバタイズの確認】

Step4で生成したIPv6 BGPプレフィクスがAS65123内で正常にアドバタイズされていることを確認します。そのために、以下のコマンドを利用します。

  • show bgp ipv6 unicast
  • show bgp ipv6 unicast neighbor {advertised-routes|routes}

R2ではshowコマンドの出力は次のようになります。

R2

R2#show bgp ipv6 unicast 
BGP table version is 2, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 2001:123:123:2::/64
                    ::                       0         32768 i
R2#show bgp ipv6 unicast neighbors 2001:123:1:1::1 advertised-routes 
BGP table version is 2, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 2001:123:123:2::/64
                    ::                       0         32768 i

Total number of prefixes 1 
R2#show bgp ipv6 unicast neighbors 2001:123:3:3::3 advertised-routes 
BGP table version is 2, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 2001:123:123:2::/64
                    ::                       0         32768 i

Total number of prefixes 1 

次の図はAS65123内でのIPv6 BGPプレフィクスのアドバタイズの様子を表しています。

図 IPv6 BGPプレフィクスのアドバタイズ(AS65123内)
図 IPv6 BGPプレフィクスのアドバタイズ(AS65123内)

【Step6:EBGPネイバーの設定】

AS65123とAS65004間でEBGPネイバーを設定します。ネイバーを確立するIPv6アドレスはリンクローカルアドレスです。リンクローカルアドレスでEBGPネイバーを確立するときには、neighbor update-sourceコマンドで出力インタフェースの指定が必要です。

R1

router bgp 65123
 neighbor FE80::4 remote-as 65004
 neighbor FE80::4 update-source ethernet0/2
 !
 address-family ipv6
  neighbor FE80::4 activate

R3

router bgp 65123
 neighbor FE80::4 remote-as 65004
 neighbor FE80::4 update-source ethernet0/2
 !
 address-family ipv6
  neighbor FE80::4 activate

R4

router bgp 65004
 neighbor FE80::1 remote-as 65123 
 neighbor FE80::1 update-source ethernet0/0
 neighbor FE80::3 remote-as 65123 
 neighbor FE80::3 update-source ethernet0/1
!
 address-family ipv6
  neighbor FE80::1 activate
  neighbor FE80::3 activate

【Step7:EBGPネイバーの確認】

EBGPネイバーが正しく確立できていることを確認します。R4でshow bgp ipv6 unicast summaryコマンドを見ると、次のようになります。

R4

R4#show bgp ipv6 unicast summary 
BGP router identifier 4.4.4.4, local AS number 65004
BGP table version is 2, main routing table version 2
1 network entries using 149 bytes of memory
2 path entries using 152 bytes of memory
2/1 BGP path/bestpath attribute entries using 248 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 573 total bytes of memory
BGP activity 1/0 prefixes, 2/0 paths, scan interval 60 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
FE80::1         4 65123       7       7        2    0    0 00:02:05        1
FE80::3         4 65123       5       5        2    0    0 00:00:15        1

EBGPネイバーが正常に確立できていれば、R4でAS65123内の2001:123:123:2::/64のプレフィクスを確認できます。R4でIPv6 BGPテーブルを見ると、次のようになります。

R4

R4#show bgp ipv6 unicast         
BGP table version is 2, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*  2001:123:123:2::/64
                    FE80::3                                0 65123 i
*>                  FE80::1                                0 65123 i

図 EBGPネイバー
図 EBGPネイバー

【Step8:BGPプレフィクスの生成(AS65004)】

AS65004のR4でIPv6 BGPプレフィクス 2001:4:4:4::/64を生成します。R4でaddress-family ipv6の中でnetworkコマンドを利用します。

R4

router bgp 65004
 address-family ipv6
  network 2001:4:4:4::/64

networkコマンドで生成したIPv6 BGPプレフィクスはAS65123へとアドバタイズされます。R1、R3でIPv6 BGPテーブルを確認すると、次のようになります。

R1

R1#show bgp ipv6 unicast 
BGP table version is 3, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 2001:4:4:4::/64  FE80::4                  0             0 65004 i
*>i2001:123:123:2::/64
                    2001:123:2:2::2          0    100      0 i

R3

R3#show bgp ipv
*Mar  1 00:36:28.723: %SYS-5-CONFIG_I: Configured from console by console
R3#show bgp ipv6 uni
R3#show bgp ipv6 unicast  
BGP table version is 3, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
* i2001:4:4:4::/64  2001:123:1:1::1          0    100      0 65004 i
*>                  FE80::4                  0             0 65004 i
*>i2001:123:123:2::/64
                    2001:123:2:2::2          0    100      0 i

R1およびR3では、EBGPネイバーであるR4から受信したプレフィクスがベストパスとなっていることがわかります。そして、R2でもAS65004の2001:4:4:4::/64を正しく受信してベストパスが選ばれています。

R2

R2#show bgp ipv6 unicast 
BGP table version is 3, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
* i2001:4:4:4::/64  2001:123:3:3::3          0    100      0 65004 i
*>i                 2001:123:1:1::1          0    100      0 65004 i
*> 2001:123:123:2::/64
                    ::                       0         32768 i
R2#show bgp ipv6 unicast 2001:4:4:4::/64
BGP routing table entry for 2001:4:4:4::/64, version 3
Paths: (2 available, best #2, table Global-IPv6-Table)
  Advertised to update-groups:
     1         
  65004, (Received from a RR-client)
    2001:123:3:3::3 (metric 10) from 2001:123:3:3::3 (3.3.3.3)
      Origin IGP, metric 0, localpref 100, valid, internal
  65004, (Received from a RR-client)
    2001:123:1:1::1 (metric 10) from 2001:123:1:1::1 (1.1.1.1)
      Origin IGP, metric 0, localpref 100, valid, internal, best

R1およびR3ではnext-hop-selfの設定を行なっていません。しかし、R1、R3からR2へプレフィクスをアドバタイズするときにはネクストホップアドレスが書き換えられています。リンクローカルアドレスを利用してEBGPネイバーを確立していると、IBGPネイバーへプレフィクスをアドバタイズするときには、自動的にnext-hop-selfの動作になります。これにより、BGPプレフィクスのネクストホップへの接続性を確保できるようにしています。

次の図は、AS65004の2001:4:4:4::/64がアドバタイズされる様子を表しています。

図  AS65004のIPv6 BGPプレフィクスのアドバタイズ
図 AS65004のIPv6 BGPプレフィクスのアドバタイズ

【Step9:通信確認】

AS65123の2001:123:123:2::/64とAS65004の2001:4:4:4::/64間の通信が正しく行えることを確認します。

R2

R2#ping 2001:4:4:4::4 source 2001:123:123:2::2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:4:4:4::4, timeout is 2 seconds:
Packet sent with a source address of 2001:123:123:2::2
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 48/67/108 ms

送信元IPv6アドレスを指定しなければPingの応答は返ってきません。

BGPの仕組み