组网需求
- 所有路由器配置BGP,Router A在AS 100,Router B、Router C在AS 300,Router D在AS 200
- 要求:充分利用网络资源,减少Router A到8.1.1.1/32的网络阻塞
组网拓扑
配置思路
- Router A与Router B、Router C之间配置EBGP,Router D与Router B、Router C之间配置EBGP
- 在Router A上配置负载分担功能,使得从Router A发送的流量可以经过Router B和Router C两条路径到Router D
配置命令
配置路由器基本功能以及各个接口IP地址
Router A配置
1
2
3
4
5
6
7
8sys
sys Router A
int g0/0/0
ip add 200.1.1.1 30
int g0/0/1
ip add 200.1.2.1 30
int LoopBack 0
ip add 1.1.1.1 32
Router B配置
1
2
3
4
5
6
7
8sys
sys Router B
int g0/0/0
ip add 200.1.1.2 30
int g0/0/2
ip add 200.1.3.2 30
int LoopBack 0
ip add 2.2.2.2 32
Router C配置
1
2
3
4
5
6
7
8sys
sys Router C
int g0/0/1
ip add 200.1.2.2 30
int g0/0/2
ip add 200.1.4.2 30
int LoopBack 0
ip add 3.3.3.3 32
Router D配置
1
2
3
4
5
6
7
8sys
sys Router D
int g0/0/0
ip add 200.1.3.1 30
int g0/0/1
ip add 200.1.4.1 30
int g0/0/0
ip add 4.4.4.4 32
配置EBGP
Router A配置
1
2
3
4
5sys
bgp 100
router-id 1.1.1.1
peer 200.1.1.2 as-number 300
peer 200.1.2.2 as-number 300
Router B配置
1
2
3
4
5sys
bgp 300
router-id 2.2.2.2
peer 200.1.1.1 as-number 100
peer 200.1.3.1 as-number 200
Router C配置
1
2
3
4
5sys
bgp 300
router-id 3.3.3.3
peer 200.1.2.1 as-number 100
peer 200.1.4.1 as-number 200
Router D配置
1
2
3
4
5sys
bgp 200
router-id 4.4.4.4
peer 200.1.3.2 as-number 300
peer 200.1.4.2 as-number 300
宣告网段
Router A配置
1
2
3
4
5sys
bgp 100
ipv4-family unicast
network 200.1.1.0 30
network 200.1.2.0 30
Router B配置
1
2
3
4
5sys
bgp 300
ipv4-family unicast
network 200.1.1.0 30
network 200.1.3.0 30
Router C配置
1
2
3
4
5sys
bgp 300
ipv4-family unicast
network 200.1.4.0 30
network 200.1.2.0 30
Router D配置
1
2
3
4
5
6sys
bgp 200
ipv4-family unicast
network 200.1.3.0 30
network 200.1.4.0 30
network 8.1.1.1 32
配置负载均衡
Router A配置
1
2
3
4sys
bgp 100
ipv4-family unicast
maximum load-balancing 2
查看结果
没有配置负载均衡前Router A的路由表
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29display routing-table 8.1.1.1 32
<Router A>dis bgp routing-table 8.1.1.1 32
BGP local router ID : 1.1.1.1
Local AS number : 100
//一条路由被选
Paths: 2 available, 1 best, 1 select
BGP routing table entry information of 8.1.1.1/32:
From: 200.1.1.2 (2.2.2.2)
Route Duration: 00h05m25s
Direct Out-interface: GigabitEthernet0/0/0
Original nexthop: 200.1.1.2
Qos information : 0x0
AS-path 300 200, origin igp, pref-val 0, valid, external, best, select, active,
pre 255
// 两个邻居都宣告
Advertised to such 2 peers:
200.1.1.2
200.1.2.2
BGP routing table entry information of 8.1.1.1/32:
From: 200.1.2.2 (3.3.3.3)
Route Duration: 00h05m19s
Direct Out-interface: GigabitEthernet0/0/1
Original nexthop: 200.1.2.2
Qos information : 0x0
AS-path 300 200, origin igp, pref-val 0, valid, external, pre 255, not preferre
d for router ID
Not advertised to any peer yet
配置负载均衡后Router A的路由表
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28display routing-table 8.1.1.1 32
<Router A>dis bgp routing-table 8.1.1.1 32
BGP local router ID : 1.1.1.1
Local AS number : 100
// 两条路由被选
Paths: 2 available, 1 best, 2 select
BGP routing table entry information of 8.1.1.1/32:
From: 200.1.1.2 (2.2.2.2)
Route Duration: 00h11m45s
Direct Out-interface: GigabitEthernet0/0/0
Original nexthop: 200.1.1.2
Qos information : 0x0
AS-path 300 200, origin igp, pref-val 0, valid, external, best, select, active,
pre 255
Advertised to such 2 peers:
200.1.1.2
200.1.2.2
BGP routing table entry information of 8.1.1.1/32:
From: 200.1.2.2 (3.3.3.3)
Route Duration: 00h11m39s
Direct Out-interface: GigabitEthernet0/0/1
Original nexthop: 200.1.2.2
Qos information : 0x0
AS-path 300 200, origin igp, pref-val 0, valid, external, select, active, pre 2
55, not preferred for router ID
Not advertised to any peer yet