aopicoのブログ -14ページ目

aopicoのブログ

ブログの説明を入力します。
→しません。

今回の内容はCiscoルータを使用してOSPFからBGPへの再配送についてです。
ちょっと長くなりそうなので2回に分けて書きます。

今回は「LSAタイプ5で得た外部ルートをBGPへ再配送」
次回は「LSAタイプ7で得た外部ルートをBGPへ再配送」です。

使用IOSは

ADVENTERPRISEK9-M 12.4(20)T

です。


NWトポロジは下図の通りです。
01_ospf_to_bgp_topology

【概要】

OSPFからBGPへ再配送するルートはデフォルトで

・内部エリアルート(intra)
・エリア間ルート(inter)

のみです。

show ip routeで

O(内部エリアルート)
OI(エリア間ルート)

プラス、Cフラグでも

roter ospf <プロセス番号>
network x.x.x.x x.x.x.x area x

などでOSPFをしゃべらせているI/FのNWアドレスがBGPへ再配送されます。


E1、E2、N1、N2フラグが立っている「OSPFへ再配送されたルート(外部ルート)」は
デフォルトでBGPへ再配送されません。

※E1、E2はLSAタイプ5、N1、N2はLSAタイプ7によって通知されます。
「show ip ospf database」で確認できます。


OSPFへ再配送されたルートをBGPへ再配送するには、

1.ルーターコンフィギュレーションモードへ移行

router bgp AS番号

2.該当ルートの外部タイプを指定

redistribute ospf OSPFプロセス番号 match [external 1 | external 2 | nssa-external 1 | nssa-external 2]

なお上記コマンドのmatch以降は省略することも可能です。その場合、
O 内部エリアルート(intra)
OI エリア間ルート(inter)
のみBGPへ再配送されます。

[ ]の中は複数指定することも可能です。

例:
redistribute ospf 1 match external 2 nssa-external 2



【設定】

以下、各ルータの(投入)コンフィグです。

-------------------------------
!R1

interface Loopback0
ip address 100.0.0.1 255.255.255.255
no shutdown

interface GigabitEthernet0/0
ip address 10.1.2.2 255.255.255.252
no shutdown

interface GigabitEthernet1/0
ip address 192.168.1.254 255.255.255.0
no shutdown

router bgp 65001
network 192.168.1.0
neighbor 100.0.0.2 remote-as 65002
neighbor 100.0.0.2 ebgp-multihop 2
neighbor 100.0.0.2 update-source Loopback0

ip route 100.0.0.2 255.255.255.255 10.1.2.1

-------------------------------
!R2

interface Loopback0
ip address 100.0.0.2 255.255.255.255
no shutdown

interface GigabitEthernet0/0
ip address 10.1.2.1 255.255.255.252
no shutdown

interface GigabitEthernet1/0
ip address 10.2.3.2 255.255.255.252
ip ospf network point-to-point
no shutdown

router ospf 1
redistribute bgp 65002 subnets
passive-interface GigabitEthernet0/0
network 10.2.3.2 0.0.0.0 area 0

router bgp 65002
redistribute ospf 1
neighbor 100.0.0.1 remote-as 65001
neighbor 100.0.0.1 ebgp-multihop 2
neighbor 100.0.0.1 update-source Loopback0

ip route 100.0.0.1 255.255.255.255 10.1.2.2

-------------------------------
!R3

interface Loopback0
ip address 100.0.0.3 255.255.255.255
no shutdown

interface GigabitEthernet0/0
ip address 10.2.3.1 255.255.255.252
ip ospf network point-to-point
no shutdown

interface GigabitEthernet1/0
ip address 10.3.4.2 255.255.255.252
ip ospf network point-to-point
no shutdown

router ospf 1
network 10.2.3.1 0.0.0.0 area 0
network 10.3.4.2 0.0.0.0 area 1

-------------------------------
!R4

interface Loopback0
ip address 100.0.0.4 255.255.255.255
no shutdown

interface GigabitEthernet0/0
ip address 10.3.4.1 255.255.255.252
ip ospf network point-to-point
no shutdown

interface GigabitEthernet1/0
ip address 10.4.6.2 255.255.255.252
no shutdown

router eigrp 1
redistribute ospf 1 metric 1000000 10 255 255 1500
passive-interface GigabitEthernet0/0
network 10.4.6.2 0.0.0.0

router ospf 1
redistribute eigrp 1 subnets
network 10.3.4.1 0.0.0.0 area 1

-------------------------------
!R6

interface Loopback0
ip address 100.0.0.6 255.255.255.255
no shutdown

interface GigabitEthernet0/0
ip address 10.4.6.1 255.255.255.252
no shutdown

router eigrp 1
network 10.4.6.1 0.0.0.0

-------------------------------

【説明】

上記コンフィグ投入後の各ルータの動作イメージは下記のような感じとなります。

04 - ospf(intra,inter,external)_to_bgp_topology
・各ルータ間の動作プロトコル

R1 ⇔ R2 → BGP
R2 ⇔ R3 → OSPF(エリア0)
R3 ⇔ R4 → OSPF(エリア1)
R4 ⇔ R6 → EIGRP

・再配送をするルータ

R2 → OSPFで学習したルートをBGPへ注入、BGPで学習したルートをOSPFへ注入
R4 → EIGRPで学習したルートをOSPFへ注入、OSPFで学習したルートをEIGRPへ注入


OSPFをBGPに再配送するR2でBGPテーブルとルーティングテーブルの確認をします。

02 - ospf(intra,inter,external)_to_bgp_R2_before


show ip route
→EIGRPからOSPFへ再配送されたルート10.4.6.0を確認できます。

show ip bgp
→EIGRPからOSPFへ再配送されたルート10.4.6.0がありません。

R2のBGPルーターコンフィグレーションモードで

redistribute ospf 1

しか投入していないため、E2フラグのついた外部ルートはBGPへ再配送されません。


下記コンフィグに変更する事でOSPFからBGPへ再配送する事が出来ます

R2のBGPルーターコンフィグレーションモードで

redistribute ospf 1 match external 2

上記コマンドを投入後、R2でBGPテーブルとルーティングテーブルの確認をします。

03 - ospf(intra,inter,external)_to_bgp_R2_after_

show ip bgp
→EIGRPからOSPFへ再配送されたルート10.4.6.0を確認できます。


以上となります。