conf t

インフラエンジニアのメモ

BGP 基本的な設定

今日はBGPを学習します。

 

設定は本当に簡単なものだけです。

構成するネットワークは以下の通りです。

f:id:monaski:20140110142202p:plain

R1が属するAS 1と、R2が属するAS 2間で、BGPによる

経路情報交換を行います。

投入するコンフィグは以下の通りです。

今回は簡単なため私には珍しくすんなり行きました。

networkコマンドはIGPでも用いられますが、BGPとIGPでは意味が異なります。

BGPの場合、ルーティングテーブルにnetworkコマンドで指定したルートが

完全一致で載っていない場合、ネイバーに伝わりません。

 

R1 R2
R1(config)#router bgp 1
R1(config-router)#neighbor 192.168.1.2 remote-as 2
R1(config-router)#network 100.1.1.0 mask 255.255.255.0
R2(config)#router bgp 2
R2(config-router)#negihbor 192.168.1.1 remote-as 1
R2(config-router)#network 100.2.1.0 mask 255.255.255.0

 

show ip route の結果は以下の通りです。

BGPのアドミニストレーティブディスタンス値は外部

BGPの場合は20、内部BGPの場合は200です。

R1
Gateway of last resort is not set

    100.0.0.0/24 is subnetted, 2 subnets
C     100.1.1.0 is directly connected, FastEthernet0/1
B     100.2.1.0 [20/0] via 192.168.1.2, 00:13:28
C  192.168.1.0/24 is directly connected, FastEthernet0/0

 

show ip protocols の結果は以下の通りです。

自身のAS番号と、ネイバーのIPアドレスがわかります。

R1

R1#show ip protocols

Routing Protocol is "bgp 1"

  Outgoing update filter list for all interfaces is not set

  Incoming update filter list for all interfaces is not set

  IGP synchronization is disabled

  Automatic route summarization is disabled

  Neighbor(s):

    Address          FiltIn FiltOut DistIn DistOut Weight RouteMap

    192.168.1.2

  Maximum path: 1

  Routing Information Sources:

    Gateway         Distance      Last Update

    192.168.1.2           20      00:24:00

  Distance: external 20 internal 200 local 200

 

次はshow ip bgp です。

 いくつのBGPルートがあるか、ベストパスがどれかがわかります。

>はベストパスを表します。

R1

R1#show ip bgp

BGP table version is 3, local router ID is 192.168.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

*> 100.1.1.0/24     0.0.0.0                  0         32768 i

*> 100.2.1.0/24     192.168.1.2              0             0 2 i