本次实验,路由器,思科的网络设备
拓扑如下(比较简单):
ospf与rip双点双向重分发实验-实现负载均衡_第1张图片
首先是动态路由协议配置及ip配置
-----------1
en
conf t
router ospf 1
router-id 1.1.1.1
netw 192.168.12.1 0.0.0.0 area 0
exit
router rip
ver 2
no aut
netwo 192.168.14.0
exit
--------------2
en
conf t
int l0
ip add 2.2.2.2 255.255.255.0
ip ospf net point-to-po
router ospf 1
router-id 2.2.2.2
network 192.168.12.2 0.0.0.0 area 0
netwo 192.168.23.2 0.0.0.0 area 0
netw 2.2.2.0 0.0.0.255 area 0
exit
---------------3
en
conf t
router ospf 1
router-id 3.3.3.3
netw 192.168.23.3 0.0.0.0 area 0
exit
router rip
ver 2
no aut
netwo 192.168.34.0
exit
--------4
en
conf t
router rip
ver 2
no aut
netw 192.168.34.0
netwo 192.168.14.0
netwo 4.4.4.0
exit
ip 地址配置:2.2.2.2是R2 4.4.4.4是R4
主要查看3和1路由器中路由表的变化

接下来是重发布,首先将AD值小的ospf重发布到AD值大的RIP中去
====================================ospf-rip

-------------------1
en
conf t
router rip
redistribute ospf 1 metric 2
end
wr
------------------3
en
conf t
router rip
red ospf 1 met 2
end
wr

====================================
其次将rip重发布到ospf中去
=====================================rip-ospf

---------------------1
en
conf t
router ospf 1
red rip subn
end
wr

---------------------3
R3#show ip route
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

Gateway of last resort is not set

  2.0.0.0/24 is subnetted, 1 subnets

O 2.2.2.0 [110/65] via 192.168.23.2, 00:19:37, Serial1/1
4.0.0.0/24 is subnetted, 1 subnets
O E2 4.4.4.0 [110/20] via 192.168.23.2, 00:06:34, Serial1/1
O 192.168.12.0/24 [110/128] via 192.168.23.2, 00:19:37, Serial1/1
O E2 192.168.14.0/24 [110/20] via 192.168.23.2, 00:06:34, Serial1/1
192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.23.0/24 is directly connected, Serial1/1
L 192.168.23.3/32 is directly connected, Serial1/1
192.168.34.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.34.0/24 is directly connected, Serial1/0
L 192.168.34.3/32 is directly connected, Serial1/0

====1上进行重发布,发现3上路由表出现了次优路径的情况,去忘4.4.4.0网段
然后3上修改AD值
++++++

en
conf t
acc 4 per 4.4.4.0
router rip
dista 100 192.168.34.4 0.0.0.0 4
end

+++++
R3#
R3#show ip route
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

Gateway of last resort is not set

  2.0.0.0/24 is subnetted, 1 subnets

O 2.2.2.0 [110/65] via 192.168.23.2, 00:21:53, Serial1/1
4.0.0.0/24 is subnetted, 1 subnets
R 4.4.4.0 [100/1] via 192.168.34.4, 00:00:19, Serial1/0
O 192.168.12.0/24 [110/128] via 192.168.23.2, 00:21:53, Serial1/1
O E2 192.168.14.0/24 [110/20] via 192.168.23.2, 00:08:50, Serial1/1
192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.23.0/24 is directly connected, Serial1/1
L 192.168.23.3/32 is directly connected, Serial1/1
192.168.34.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.34.0/24 is directly connected, Serial1/0
L 192.168.34.3/32 is directly connected, Serial1/0
R3#
R3#
再次查看路由表,发现次优路径问题在
上已经修正
但因为是双点双向重发布,所以3上也需要配置重发布
-+-+-+-+-+-+-++--
en
conf t
router ospf 1
red rip subn
end
wr

配置完成后,查看R1的路由表
R1#show ip route
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

Gateway of last resort is not set

  2.0.0.0/24 is subnetted, 1 subnets

O 2.2.2.0 [110/65] via 192.168.12.2, 00:27:10, Serial1/0
4.0.0.0/24 is subnetted, 1 subnets
O E2 4.4.4.0 [110/20] via 192.168.12.2, 00:00:18, Serial1/0
192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.12.0/24 is directly connected, Serial1/0
L 192.168.12.1/32 is directly connected, Serial1/0
192.168.14.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.14.0/24 is directly connected, Serial1/1
L 192.168.14.1/32 is directly connected, Serial1/1
O 192.168.23.0/24 [110/128] via 192.168.12.2, 00:27:34, Serial1/0
O E2 192.168.34.0/24 [110/20] via 192.168.12.2, 00:00:18, Serial1/0
R1#
R1#
R1#

我们发现1上也出现了关于4.4.4.0网段的次优路径问题

此时我们将1的来自4.4.4.0的路由的AD值修改
-------1
en
conf t
acc 4 per 4.4.4.0
router rip
dista 100 192.168.14.4 0.0.0.0 4
end

此时我们再次查看1的路由表

R1#show ip route

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

Gateway of last resort is not set

  2.0.0.0/24 is subnetted, 1 subnets

O 2.2.2.0 [110/65] via 192.168.12.2, 00:32:27, Serial1/0
4.0.0.0/24 is subnetted, 1 subnets
R 4.4.4.0 [100/1] via 192.168.14.4, 00:00:02, Serial1/1
192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.12.0/24 is directly connected, Serial1/0
L 192.168.12.1/32 is directly connected, Serial1/0
192.168.14.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.14.0/24 is directly connected, Serial1/1
L 192.168.14.1/32 is directly connected, Serial1/1
O 192.168.23.0/24 [110/128] via 192.168.12.2, 00:32:51, Serial1/0
O E2 192.168.34.0/24 [110/20] via 192.168.12.2, 00:05:35, Serial1/0
R1#
R1#
R1#

发现次优路径问题也修正完成
然后查看网络中其他设备的路由表

R2#show ip route
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

Gateway of last resort is not set

  2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C 2.2.2.0/24 is directly connected, Loopback0
L 2.2.2.2/32 is directly connected, Loopback0
4.0.0.0/24 is subnetted, 1 subnets
O E2 4.4.4.0 [110/20] via 192.168.23.3, 00:05:52, Serial1/1
[110/20] via 192.168.12.1, 00:00:19, Serial1/0
192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.12.0/24 is directly connected, Serial1/0
L 192.168.12.2/32 is directly connected, Serial1/0
O E2 192.168.14.0/24 [110/20] via 192.168.12.1, 00:18:17, Serial1/0
192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.23.0/24 is directly connected, Serial1/1
L 192.168.23.2/32 is directly connected, Serial1/1
O E2 192.168.34.0/24 [110/20] via 192.168.23.3, 00:05:52, Serial1/1
R2#
R2#
R2#
R2#

R3#show ip route
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

Gateway of last resort is not set

  2.0.0.0/24 is subnetted, 1 subnets

O 2.2.2.0 [110/65] via 192.168.23.2, 00:31:12, Serial1/1
4.0.0.0/24 is subnetted, 1 subnets
R 4.4.4.0 [100/1] via 192.168.34.4, 00:00:01, Serial1/0
O 192.168.12.0/24 [110/128] via 192.168.23.2, 00:31:12, Serial1/1
O E2 192.168.14.0/24 [110/20] via 192.168.23.2, 00:18:09, Serial1/1
192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.23.0/24 is directly connected, Serial1/1
L 192.168.23.3/32 is directly connected, Serial1/1
192.168.34.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.34.0/24 is directly connected, Serial1/0
L 192.168.34.3/32 is directly connected, Serial1/0
R3#
R3#
R3#
R3#
R3#

R4#show ip route
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

Gateway of last resort is not set

  2.0.0.0/24 is subnetted, 1 subnets

R 2.2.2.0 [120/2] via 192.168.34.3, 00:00:16, Serial1/0
[120/2] via 192.168.14.1, 00:00:18, Serial1/1
4.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 4.4.4.0/24 is directly connected, Loopback0
L 4.4.4.4/32 is directly connected, Loopback0
R 192.168.12.0/24 [120/2] via 192.168.34.3, 00:00:16, Serial1/0
[120/2] via 192.168.14.1, 00:00:18, Serial1/1
192.168.14.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.14.0/24 is directly connected, Serial1/1
L 192.168.14.4/32 is directly connected, Serial1/1
R 192.168.23.0/24 [120/2] via 192.168.34.3, 00:00:16, Serial1/0
[120/2] via 192.168.14.1, 00:00:18, Serial1/1
192.168.34.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.34.0/24 is directly connected, Serial1/0
L 192.168.34.4/32 is directly connected, Serial1/0
R4#
R4#
R4#
R4#

2与4之间的链路实现了负载均衡

感谢观看,希望指出问题,我对这块也只是初学者