组网需求
- 网络中R1、R2、R3三台路由器,R1到R3的开销为10,R1到R2开销为5,R2到R3开销为5
- 通过配置,R1可以通过R1-R3路径访问R3的环回地址,也可以通过R1-R2-R3访问R3的环回地址
组网拓扑
配置思路
- 配置路由器基本功能以及各个接口IP地址
- 配置OSPF路由协议,宣告路由,配置接口开销值
- 在R1路由器上配置路由负载分担
配置命令
配置路由器基本功能以及各个接口IP地址
R1配置
1
2
3
4
5
6sys
sys R1
int g0/0/0
ip add 10.1.13.1 30
int g0/0/1
ip add 10.1.12.1 30
R2配置
1
2
3
4
5
6sys
sys R2
int g0/0/1
ip add 10.1.12.2 30
int g0/0/2
ip add 10.1.23.2 30
R3配置
1
2
3
4
5
6
7
8sys
sys R3
int g0/0/0
ip add 10.1.13.2 30
int g0/0/1
ip add 10.1.23.1 30
int LoopBack 0
ip add 10.1.3.3 32
配置OSPF路由协议,宣告路由,配置接口开销值
R1配置
1
2
3
4
5
6
7
8
9
10sys
ospf 1 router-id 10.1.1.1
area 0
network 10.1.12.0 0.0.0.3
network 10.1.13.0 0.0.0.3
int g0/0/0
ospf cost 10
int g0/0/1
ospf cost 5
R2配置
1
2
3
4
5
6
7
8
9
10sys
ospf 1 router-id 10.1.2.2
area 0
network 10.1.12.0 0.0.0.3
network 10.1.23.0 0.0.0.3
int g0/0/1
ospf cost 5
int g0/0/2
ospf cost 5
R3配置
1
2
3
4
5
6
7
8
9
10sys
ospf 1 router-id 10.1.3.3
area 0
network 10.1.13.0 0.0.0.3
network 10.1.23.0 0.0.0.3
int g0/0/0
ospf cost 10
int g0/0/2
ospf cost 5
在R1路由器上配置路由负载分担
R1配置
1
2
3sys
ospf 1
maximum load-balancing 2
查看结果
查看路由表,并查看到R3回环口的开销值是否一样
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
29
30
31
32display ip routing-table
<R1>display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 12 Routes : 13
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.1.3.3/32 OSPF 10 10 D 10.1.13.2 GigabitEthernet
0/0/0
OSPF 10 10 D 10.1.12.2 GigabitEthernet
0/0/1
10.1.12.0/30 Direct 0 0 D 10.1.12.1 GigabitEthernet
0/0/1
10.1.12.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
10.1.12.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
10.1.13.0/30 Direct 0 0 D 10.1.13.1 GigabitEthernet
0/0/0
10.1.13.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.13.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.23.0/30 OSPF 10 10 D 10.1.12.2 GigabitEthernet
0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
测试到R3回环口是否可以通过R1-R3和R1-R2-R3的路径负载分担
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46tracert -q 200 10.1.3.3
<R1>tracert -q 200 10.1.3.3
traceroute to 10.1.3.3(10.1.3.3), max hops: 30 ,packet length: 40,press CTRL_C
to break
1 10.1.12.2 30 ms 20 ms 20 ms 20 ms
10.1.13.2 40 ms 20 ms 20 ms 10 ms 20ms 20 ms
10.1.12.2 10 ms 10 ms
10.1.13.2 10 ms 20 ms 10 ms 20 ms 10 ms 10 ms
10.1.12.2 10 ms 20 ms 30 ms 10 ms 1 ms
10.1.13.2 20 ms 20 ms 20 ms 20 ms 10 ms 10 ms
10.1.12.2 20 ms 10 ms 30 ms 20 ms 20 ms
10.1.13.2 10 ms 20 ms 20 ms 1 ms 30 ms
10.1.12.2 20 ms 20 ms 20 ms 20 ms 20 ms 20 ms
10.1.13.2 10 ms 20 ms 20 ms 10 ms 10 ms
10.1.12.2 20 ms 20 ms 20 ms 20 ms 20 ms 20 ms
10.1.13.2 30 ms 20 ms 20 ms 10 ms 20 ms
10.1.12.2 20 ms 20 ms 20 ms 30 ms 20 ms
10.1.13.2 20 ms 20 ms 20 ms 20 ms 10 ms 20 ms
10.1.12.2 30 ms 10 ms 20 ms 30 ms 20 ms
10.1.13.2 20 ms 10 ms 20 ms 20 ms 30 ms 10 ms
10.1.12.2 30 ms 30 ms 20 ms 20 ms 20 ms
10.1.13.2 20 ms 20 ms 20 ms 10 ms 40 ms
10.1.12.2 20 ms 20 ms 20 ms 20 ms 20 ms 20 ms
10.1.13.2 20 ms 20 ms 30 ms
10.1.12.2 20 ms 20 ms
10.1.13.2 20 ms 20 ms 20 ms 20 ms 20 ms
10.1.12.2 20 ms 30 ms 20 ms 20 ms 20 ms 20 ms
10.1.13.2 20 ms 20 ms 20 ms 30 ms 20 ms
10.1.12.2 20 ms 20 ms 10 ms 20 ms 20 ms 20 ms
10.1.13.2 20 ms 20 ms 20 ms 20 ms 10 ms
10.1.12.2 20 ms 10 ms 20 ms 10 ms 20 ms
10.1.13.2 20 ms 20 ms 20 ms 20 ms 20 ms 30 ms
10.1.12.2 10 ms 20 ms 10 ms 10 ms 1 ms
10.1.13.2 30 ms 10 ms 20 ms 30 ms 20 ms 20 ms
10.1.12.2 20 ms 10 ms 20 ms 20 ms 20 ms
10.1.13.2 20 ms 20 ms 10 ms 20 ms 30 ms
10.1.12.2 30 ms 20 ms 20 ms 20 ms 20 ms 20 ms
10.1.13.2 20 ms 20 ms 30 ms 20 ms 20 ms
10.1.12.2 20 ms 10 ms 10 ms 20 ms 20 ms
10.1.13.2 20 ms 20 ms 30 ms 20 ms 20 ms 20 ms
10.1.12.2 20 ms 20 ms 20 ms 20 ms 20 ms
10.1.13.2 30 ms 20 ms 20 ms 1 ms 10 ms 20 ms
10.1.12.2 10 ms 10 ms 10 ms 30 ms