BGPで異なるASに対するEBGPロードバランシングするための設定方法を記載します。
目次
- 1. 前提条件
- 2. 要件
- 3. 設定例
- 4. 動作確認
- 4.1. show ip bgp
- 4.2. show ip route
- 4.3. traceroute
- 5. 補足
1. 前提条件
本記事は以下に基づいて作成しています。
・Cisco VIRL 1.6.65
・Cisco IOS Software, Version 15.7(3)M3
2. 要件
- R1のLo0のセグメントからR4のLo0のセグメントに通信する際、R1からR2とR3にECMP(等コストマルチパス)で負荷分散されるように設定してください。
3. 設定例
要件を満たす設定例を以下に示します。
R1
hostname R1
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface GigabitEthernet0/1
ip address 192.168.12.1 255.255.255.0
!
interface GigabitEthernet0/2
ip address 192.168.13.1 255.255.255.0
!
router bgp 1
bgp log-neighbor-changes
bgp bestpath as-path multipath-relax
network 1.1.1.1 mask 255.255.255.255
neighbor 192.168.12.2 remote-as 2
neighbor 192.168.13.3 remote-as 3
maximum-paths 2
!
end
R2
hostname R2
!
interface GigabitEthernet0/1
ip address 192.168.12.2 255.255.255.0
!
interface GigabitEthernet0/2
ip address 192.168.24.2 255.255.255.0
!
router bgp 2
bgp log-neighbor-changes
neighbor 192.168.12.1 remote-as 1
neighbor 192.168.24.4 remote-as 4
!
end
R3
hostname R3
!
interface GigabitEthernet0/1
ip address 192.168.13.3 255.255.255.0
!
interface GigabitEthernet0/2
ip address 192.168.34.3 255.255.255.0
!
router bgp 3
bgp log-neighbor-changes
neighbor 192.168.13.1 remote-as 1
neighbor 192.168.34.4 remote-as 4
!
end
R4
hostname R4
!
interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface GigabitEthernet0/1
ip address 192.168.24.4 255.255.255.0
!
interface GigabitEthernet0/2
ip address 192.168.34.4 255.255.255.0
!
router bgp 4
bgp log-neighbor-changes
network 4.4.4.4 mask 255.255.255.255
neighbor 192.168.24.2 remote-as 2
neighbor 192.168.34.3 remote-as 3
!
end
4. 動作確認
4.1. show ip bgp
- R1のBGPテーブルに4.4.4.4/32のルートが2つ登録されており、1つがベストパス(>)、もう1つがマルチパス(m)となっていることを確認します。
R1#show ip bgp
BGP table version is 4, local router ID is 1.1.1.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,
t secondary path,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.1/32 0.0.0.0 0 32768 i
*m 4.4.4.4/32 192.168.12.2 0 2 4 i
*> 192.168.13.3 0 3 4 i
4.2. show ip route
- R1のルーティングテーブルに4.4.4.4/32のルートが2つ登録されていることを確認します。
R1#show ip route bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override, p - overrides from PfR
Gateway of last resort is not set
4.0.0.0/32 is subnetted, 1 subnets
B 4.4.4.4 [20/0] via 192.168.13.3, 00:48:34
[20/0] via 192.168.12.2, 00:48:34
4.3. traceroute
- R1のLo0のセグメントからR4のLo0のセグメントへの通信が、R2(192.168.12.2)とR3(192.168.13.3)に負荷分散されていることを確認します。
R1#traceroute 4.4.4.4 source 1.1.1.1 numeric
Type escape sequence to abort.
Tracing the route to 4.4.4.4
VRF info: (vrf in name/id, vrf out name/id)
1 192.168.12.2 2 msec
192.168.13.3 3 msec
192.168.12.2 4 msec
2 192.168.34.4 4 msec
192.168.24.4 4 msec *
5. 補足
- BGPでロードバランシングするための条件の1つとして、ロードバランスしたいルートは同じASパス番号と同じASパス長を持つ必要があります。bgp bestpath as-path multipath-relaxコマンドを使用することで、この条件をASパス長の一致のみに緩和することができます。このコマンドはルータコンフィギュレーションモードで使用しますが、隠しコマンドであるため、?やタブ補完では表示されません。