BGPの基本設定


■BGPの基本設定
R1で基本的なBGPの設定を説明します。
①BGPプロセスを設定する。
R1(config)#rotuer bgp [AS番号]

②BGPを貼るネイバーを設定する
R1(config-router)#neighbor [ピアを張るルータのIP] remote-as [AS番号]

③通知する経路を設定する
R1(config-router)#network [ネットワークIP] mask [サブネットマスク]

①②③の結果は以下となります。
R1(config)#rotuer bgp 1
R1(config-router)#neighbor 192.168.0.2 remote-as 2
R1(config-router)#network 10.10.10.0 mask 255.255.255.0

R1のコンフィグ設定R2のコンフィグ設定
interface Ethernet1/0
ip address 192.168.0.1 255.255.255.0
duplex full
!
interface Ethernet1/1
ip address 10.10.10.1 255.255.255.0
duplex full
!
router bgp 1
bgp log-neighbor-changes
network 10.10.10.0 mask 255.255.255.0
neighbor 192.168.0.2 remote-as 2
interface Ethernet1/0
ip address 192.168.0.2 255.255.255.0
duplex full
!
interface Ethernet1/1
ip address 20.20.20.1 255.255.255.0
duplex full
!
router bgp 2
bgp log-neighbor-changes
network 20.20.20.0 mask 255.255.255.0
neighbor 192.168.0.1 remote-as 1
R1の経路情報R2の経路情報
R1#show ip route
<中略>
Gateway of last resort is not set
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.10.10.0/24 is directly connected, Ethernet1/1
L 10.10.10.1/32 is directly connected, Ethernet1/1
20.0.0.0/24 is subnetted, 1 subnets
B 20.20.20.0 [20/0] via 192.168.0.2, 01:25:04
192.168.0.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.0.0/24 is directly connected, Ethernet1/0
L 192.168.0.1/32 is directly connected, Ethernet1/0
R2#show ip route
<中略>
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 1 subnets
B 10.10.10.0 [20/0] via 192.168.0.1, 01:25:57
20.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 20.20.20.0/24 is directly connected, Ethernet1/1
L 20.20.20.1/32 is directly connected, Ethernet1/1
192.168.0.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.0.0/24 is directly connected, Ethernet1/0
L 192.168.0.2/32 is directly connected, Ethernet1/0

■ベストパスの確認
「*」はその経路情報が有効であることを示している。
「>」はベストパスであることを示している。

R1のBGP状態R2のBGP状態
R1#show ip bgp
<中略>
BGP table version is 3, local router ID is 10.10.10.1
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i – IGP, e – EGP, ? – incomplete
RPKI validation codes: V valid, I invalid, N Not found

Network Next Hop Metric LocPrf Weight Path
*> 10.10.10.0/24 0.0.0.0 0 32768 i
*> 20.20.20.0/24 192.168.0.2 0 0 2 i
R2#show ip bgp
<中略>
BGP table version is 3, local router ID is 192.168.0.2
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
Origin codes: i – IGP, e – EGP, ? – incomplete
RPKI validation codes: V valid, I invalid, N Not found

Network Next Hop Metric LocPrf Weight Path
*> 10.10.10.0/24 192.168.0.1 0 0 1 i
*> 20.20.20.0/24 0.0.0.0 0 32768 i

■近接ルータの情報確認

R1のBGP状態
R1#show ip bgp summary
<中略>
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
192.168.0.2 4 2 318 320 5 0 0 04:45:18 1
R2のBGP状態
R2#show ip bgp summary
<中略>
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
192.168.0.1 4 1 976 972 5 0 0 14:43:15 1