NWエンジニアの勉強ブログ

NWエンジニアです。勉強した内容を気ままにまとめていきます。

BGP Confederationの構築



こんにちは!
今回は『BGP Confederation』を使用したNWを構築したので、そのレポートです。

1.『BGP Confederation』特徴

iBGPはルーティングループ防止のため、iBGPで学習した経路をほかのピアに広告しない、というスプリットホライズン機能が働きます。
そのため、BGPルータの数が多いAS内においてフルメッシュでピアリングしようとすると、その数は膨大となり設定も管理も大変です。

BGP Confederationは、サブASという小さなASが集まって一つのASを構成することによりピア数を減らすことが可能な技術です。

2.構成図と設計

今回は、下記の構成で構築しました。

サブAS123(RT1~3)とサブAS456(RT4~6)によってAS1000を構成しています。
※検証構成のためAS番号は適当ですが、サブASにはプライベートAS番号を使用し、外部に流れないようにすることが一般的なようです。

3.構築1 サブASを作る

まずは、BGP Confederationの設定前までを設定してみます。
特別込み入ったコンフィグではありませんが、注意点としては、
   router bgp <サブAS番号>
となることです。

hostname RT1
!
interface GigabitEthernet0/0
 ip add 10.1.12.1 255.255.255.0
 no shutdown
!
interface GigabitEthernet0/1
 ip add 10.1.13.1 255.255.255.0
 no shutdown
!
int loopback 0
 ip add 1.1.1.1 255.255.255.255
!
router ospf 1
 network 10.1.12.0 0.0.0.255 area 0
 network 10.1.13.0 0.0.0.255 area 0 
 network 1.1.1.1 0.0.0.0 area 0
 passive-interface loopback0
!
router bgp 123
 neighbor AS123 peer-group
 neighbor AS123 remote-as 123
 neighbor AS123 update-source Loopback0
 neighbor 2.2.2.2 peer-group AS123
 neighbor 3.3.3.3 peer-group AS123
 network 1.1.1.1 mask 255.255.255.255
hostname RT2
!
interface GigabitEthernet0/0
  ip address 10.1.12.2 255.255.255.0
 no shutdown
!
interface GigabitEthernet0/1
 ip address 10.1.23.2 255.255.255.0
 no shutdown
!
interface GigabitEthernet0/2
 ip address 10.1.24.2 255.255.255.0
 no shutdown
!
interface GigabitEthernet0/3
 ip address 10.1.27.2 255.255.255.0
 no shutdown
!
int loopback 0
 ip add 2.2.2.2 255.255.255.255
!
router ospf 1
 network 10.1.12.0 0.0.0.255 area 0
 network 10.1.23.0 0.0.0.255 area 0 
 network 10.1.24.0 0.0.0.255 area 0
 network 2.2.2.2 0.0.0.0 area 0
 passive-interface loopback0
!
router bgp 123
 neighbor AS123 peer-group
 neighbor AS123 remote-as 123
 neighbor AS123 update-source Loopback0
 neighbor AS123 next-hop-self
 neighbor 1.1.1.1 peer-group AS123
 neighbor 3.3.3.3 peer-group AS123
 network 2.2.2.2 mask 255.255.255.255
 redistribute static
!
ip route 7.7.7.7 255.255.255.255 10.1.27.7
!
hostname RT3
!
interface GigabitEthernet0/0
 ip add 10.1.13.3 255.255.255.0
 no shutdown
!
interface GigabitEthernet0/1
 ip add 10.1.23.3 255.255.255.0
 no shutdown
!
interface GigabitEthernet0/2
 ip add 10.1.35.3 255.255.255.0
 no shutdown
!
int loopback 0
 ip add 3.3.3.3 255.255.255.255
!
router ospf 1
 network 10.1.13.0 0.0.0.255 area 0
 network 10.1.23.0 0.0.0.255 area 0 
 network 10.1.35.0 0.0.0.255 area 0
 network 3.3.3.3 0.0.0.0 area 0
 passive-interface loopback0
!
router bgp 123
 neighbor AS123 peer-group
 neighbor AS123 remote-as 123
 neighbor AS123 update-source Loopback0
 neighbor 1.1.1.1 peer-group AS123
 neighbor 2.2.2.2 peer-group AS123
 network 3.3.3.3 mask 255.255.255.255
hostname RT4
!
interface GigabitEthernet0/0
 ip add 10.1.24.4 255.255.255.0
 no shutdown
!
interface GigabitEthernet0/1
 ip add 10.1.45.4 255.255.255.0
 no shutdown
!
interface GigabitEthernet0/2
 ip add 10.1.46.4 255.255.255.0
 no shutdown
!
int loopback 0
 ip add 4.4.4.4 255.255.255.255
!
router ospf 1
 network 10.1.24.0 0.0.0.255 area 0
 network 10.1.45.0 0.0.0.255 area 0 
 network 10.1.46.0 0.0.0.255 area 0
 network 4.4.4.4 0.0.0.0 area 0
 passive-interface loopback0
!
router bgp 456
 neighbor AS456 peer-group
 neighbor AS456 remote-as 456
 neighbor AS456 update-source Loopback0
 neighbor 5.5.5.5 peer-group AS456
 neighbor 6.6.6.6 peer-group AS456
 network 4.4.4.4 mask 255.255.255.255
hostname RT5
!
interface GigabitEthernet0/0
 ip add 10.1.35.5 255.255.255.0
 no shutdown
!
interface GigabitEthernet0/1
 ip add 10.1.45.5 255.255.255.0
 no shutdown
!
interface GigabitEthernet0/2
 ip add 10.1.56.5 255.255.255.0
 no shutdown
!
int loopback 0
 ip add 5.5.5.5 255.255.255.255
!
router ospf 1
 network 10.1.35.0 0.0.0.255 area 0
 network 10.1.45.0 0.0.0.255 area 0 
 network 10.1.56.0 0.0.0.255 area 0
 network 5.5.5.5 0.0.0.0 area 0
 passive-interface loopback0
!
router bgp 456
 neighbor AS456 peer-group
 neighbor AS456 remote-as 456
 neighbor AS456 update-source Loopback0
 neighbor 4.4.4.4 peer-group AS456
 neighbor 6.6.6.6 peer-group AS456
 network 5.5.5.5 mask 255.255.255.255
hostname RT6
!
interface GigabitEthernet0/0
 ip add 10.1.46.6 255.255.255.0
 no shutdown
!
interface GigabitEthernet0/1
 ip add 10.1.56.6 255.255.255.0
 no shutdown
!
interface GigabitEthernet0/2
 ip add 10.1.68.6 255.255.255.0
 no shutdown
!
int loopback 0
 ip add 6.6.6.6 255.255.255.255
!
router ospf 1
 network 10.1.46.0 0.0.0.255 area 0 
 network 10.1.56.0 0.0.0.255 area 0
 network 6.6.6.6 0.0.0.0 area 0
 passive-interface loopback0
!
router bgp 456
 neighbor AS456 peer-group
 neighbor AS456 remote-as 456
 neighbor AS456 update-source Loopback0
 neighbor AS456 next-hop-self
 neighbor 4.4.4.4 peer-group AS456
 neighbor 5.5.5.5 peer-group AS456
 network 6.6.6.6 mask 255.255.255.255
 redistribute static
!
ip route 8.8.8.8 255.255.255.255 10.1.68.8
hostname RT7
!
interface GigabitEthernet0/0
 ip add 10.1.27.7 255.255.255.0
 no shutdown
!
int loopback 0
 ip add 7.7.7.7 255.255.255.255
!
ip route 0.0.0.0 0.0.0.0 10.1.27.2
hostname RT8
!
interface GigabitEthernet0/0
 ip add 10.1.68.8 255.255.255.0
 no shutdown
!
int loopback 0
 ip add 8.8.8.8 255.255.255.255
!
ip route 0.0.0.0 0.0.0.0 10.1.68.6

4.構築2 BGP Confederation設定

それでは本題のBGP Confederationの設定を投入します。
フォーマットは下記の通りです。
router bgp <サブAS>
 bgp confederation identifier   #共通
 bgp confederation peers <対向のサブAS>  #サブAS間のASBR

また、サブASのASBR間はeBGPピアとなるため、RT2~5ではeBGP関連の設定も追加します。

#RT1
router bgp 123
 bgp confederation identifier 1000
#RT2
router bgp 123
 bgp confederation identifier 1000
 bgp confederation peers 456
 neighbor 4.4.4.4 remote-as 456
 neighbor 4.4.4.4 update-source loopback 0
 neighbor 4.4.4.4 next-hop-self
 neighbor 4.4.4.4 ebgp-multihop
#RT3
router bgp 123
 bgp confederation identifier 1000
 bgp confederation peers 456
 neighbor AS123 next-hop-self
 neighbor 5.5.5.5 remote-as 456
 neighbor 5.5.5.5 update-source loopback 0
 neighbor 5.5.5.5 next-hop-self
 neighbor 5.5.5.5 ebgp-multihop
#RT4
router bgp 456
 bgp confederation identifier 1000
 bgp confederation peers 123
 neighbor AS456 next-hop-self
 neighbor 2.2.2.2 remote-as 123
 neighbor 2.2.2.2 update-source loopback 0
 neighbor 2.2.2.2 next-hop-self
 neighbor 2.2.2.2 ebgp-multihop
#RT5
router bgp 456
 bgp confederation identifier 1000
 bgp confederation peers 123
 neighbor AS456 next-hop-self
 neighbor 3.3.3.3 remote-as 123
 neighbor 3.3.3.3 update-source loopback 0
 neighbor 3.3.3.3 next-hop-self
 neighbor 3.3.3.3 ebgp-multihop
#RT6
router bgp 456
 bgp confederation identifier 1000

5.まとめ次回

以上で、BGP Confederation構築に必要なコンフィグの投入は完了です。
次回は今回構築した構成の状態確認をしていきます。
shirase96476559.hatenablog.com