BGP(基本設定 ループバックでピア)⑨
の続きです。
「BGP(基本設定 ループバックでピア)⑧」では、ピアを張る際、相手ルータのループバックアドレスを指定しました。
ところが、各ルータのルーティングテーブルには、コネクテッド(「C」)のエントリしかありませんでした。
それもそのはずです。
ピアに指定した相手ルータのループバックアドレスにアクセスできなかったからです。
今度は、IGPにOSPFを使用し、ループバックアドレスへアクセスできるようにします。
使用するネットワークは下図になります。

ここで、気を付けなければならないことは、アドミニストレーティブディスタンス(AD)の値です。各ルーティングプロトコルのAD値は、以下のようになっています。
・eBGP ・・・ 20
・iBGP ・・・ 200
・OSPF ・・・ 110
Router_AのE0までもOSPFのエリアに含めてしまうと、iBGPのAD値200ルートよりOSPFのAD値110のルートが優先されてしまうことになります。
ここでは、Router_AのE0は、OSPFのエリア0に含めないことにします。
それでは、各ルータにOSPFの設定を追加してゆきます。
強制的にインタフェースをUPさせるために、Router_AのE0インタフェースで「no keepalive」コマンドを設定しておきます。
●Router_Aの設定
!
version 11.2
no service udp-small-servers
no service tcp-small-servers
!
hostname Router_A
!
enable password cisco
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface Ethernet0
ip address 10.10.10.1 255.255.255.0
no keepalive
!
interface Serial0
ip address 172.16.0.1 255.255.0.0
clockrate 64000
!
interface Serial1
ip address 172.18.0.1 255.255.0.0
clockrate 64000
!
router ospf 1
network 172.0.0.0 0.255.255.255 area 0
network 1.1.1.1 0.0.0.0 area 0
!
router bgp 100
no synchronization
network 10.10.10.0 mask 255.255.255.0
network 172.16.0.0
network 172.18.0.0
neighbor 2.2.2.2 remote-as 100
neighbor 2.2.2.2 update-source Loopback0
neighbor 3.3.3.3 remote-as 100
neighbor 3.3.3.3 update-source Loopback0
no auto-summary
!
ip classless
!
line con 0
line aux 0
line vty 0 4
password cisco
login
!
end
●Router_Bの設定
!
version 11.2
no service udp-small-servers
no service tcp-small-servers
!
hostname Router_B
!
enable password cisco
!
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface Serial0
ip address 172.16.0.2 255.255.0.0
!
interface Serial1
ip address 172.17.0.1 255.255.0.0
clockrate 64000
!
router ospf 1
network 0.0.0.0 255.255.255.255 area 0
!
router bgp 100
no synchronization
network 172.16.0.0
network 172.17.0.0
neighbor 1.1.1.1 remote-as 100
neighbor 1.1.1.1 update-source Loopback0
neighbor 3.3.3.3 remote-as 100
neighbor 3.3.3.3 update-source Loopback0
no auto-summary
!
ip classless
!
line con 0
exec-timeout 0 0
line aux 0
line vty 0 4
password cisco
login
!
end
●Router_Cの設定
!
version 11.2
no service udp-small-servers
no service tcp-small-servers
!
hostname Router_C
!
enable password cisco
!
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface Serial0
ip address 172.17.0.2 255.255.0.0
!
interface Serial1
ip address 172.18.0.2 255.255.0.0
!
router ospf 1
network 0.0.0.0 255.255.255.255 area 0
!
router bgp 100
no synchronization
network 172.17.0.0
network 172.18.0.0
neighbor 1.1.1.1 remote-as 100
neighbor 1.1.1.1 update-source Loopback0
neighbor 2.2.2.2 remote-as 100
neighbor 2.2.2.2 update-source Loopback0
no auto-summary
!
ip classless
!
line con 0
exec-timeout 0 0
line aux 0
line vty 0 4
password cisco
login
!
end
各ルータのルーティングテーブルを確認してみます。
●Router_Aのルーティングテーブル
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/65] via 172.16.0.2, 00:06:01, Serial0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/65] via 172.18.0.2, 00:06:01, Serial1
10.0.0.0/24 is subnetted, 1 subnets
C 10.10.10.0 is directly connected, Ethernet0
C 172.16.0.0/16 is directly connected, Serial0
O 172.17.0.0/16 [110/128] via 172.16.0.2, 00:06:01, Serial0
[110/128] via 172.18.0.2, 00:06:01, Serial1
C 172.18.0.0/16 is directly connected, Serial1
●Router_Bのルーティングテーブル
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/65] via 172.16.0.1, 00:05:29, Serial0
2.0.0.0/32 is subnetted, 1 subnets
C 2.2.2.2 is directly connected, Loopback0
3.0.0.0/32 is subnetted, 1 subnets
O 3.3.3.3 [110/65] via 172.17.0.2, 00:05:29, Serial1
10.0.0.0/24 is subnetted, 1 subnets
B 10.10.10.0 [200/0] via 1.1.1.1, 00:05:25
C 172.16.0.0/16 is directly connected, Serial0
C 172.17.0.0/16 is directly connected, Serial1
O 172.18.0.0/16 [110/128] via 172.16.0.1, 00:05:29, Serial0
[110/128] via 172.17.0.2, 00:05:29, Serial1
●Router_Cのルーティングテーブル
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/65] via 172.18.0.1, 00:04:17, Serial1
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/65] via 172.17.0.1, 00:04:17, Serial0
3.0.0.0/32 is subnetted, 1 subnets
C 3.3.3.3 is directly connected, Loopback0
10.0.0.0/24 is subnetted, 1 subnets
B 10.10.10.0 [200/0] via 1.1.1.1, 00:04:15
O 172.16.0.0/16 [110/128] via 172.17.0.1, 00:04:17, Serial0
[110/128] via 172.18.0.1, 00:04:17, Serial1
C 172.17.0.0/16 is directly connected, Serial0
C 172.18.0.0/16 is directly connected, Serial1
Router_B、Router_Cのルーティングテーブルのエントリに、BGPによるルート「10.10.10.0」が現れました。