「实战」现网中各种动态路由怎么实现互联互通,一分钟了解下

2023-06-11 10:01:35

一、路由重分布

1、当许多运行多路由的网络要集成到一起时,必须在这些不同的路由选择协议之间共享路由信息。在路由选择协议之间交换路 由信息的 过程被称 为路由重分布

2、路由重分布为在同一个互联网络中高效地支持多种路由协议提供了可能,执行路由重分布的路由器被称为边界路由器,因为它们位于两个或多个自治系统的边界上。路由重分布时计量单位和管理距离是必须要考虑的。

二、RIP、EIGRP 和 OSPF 重分布

1.目的

(1)种子度量值的配置

(2)路由重分布参数的配置

(3)静态路由重分布

(4)RIP 和 EIGRP 的重分布

(5)EIGRP 和 OSPF 的重分布

(6)重分布路由的查看和调试

2.拓扑

3.实验步骤

(1)步骤 1:配置路由器 R1

R1(config)# router rip

R1(config-router)# version 2

R1(config-router)# no auto-summary

R1(config-router)# network 192.168.12.0

R1(config-router)# redistribute static metric 3 //重分布静态路由

R1(config)#ip route 0.0.0.0 0.0.0.0 Serial0/0/1

ip route 0.0.0.0 0.0.0.0 Serial0/0/1

【注意】

在向 RIP 区域重分布路由的时候,必须指定度量值,或者通过“ default-metric”命

令设置缺省种子度量值,因为 RIP 默认种子度量值为无限大,但是只有重分布静态特殊,可

以不指定种子度量值。

(2)步骤 2:配置路由器 R2

R2(config)# router eigrp 1

R2(config-router)# no auto-summary

R2(config-router)# network 192.168.23.0

R2(config-router)# redistribute rip metric 1000 100 255 1 1500

//将 RIP 重分布到 EIGRP 中

【提示】

因为 EIGRP 的度量相对复杂,所以重分布时需要分别指定带宽、延迟、可靠性、负载以

及 MTU 参数的值。

R2(config)# router rip

R2(config-router)# version 2

R2(config-router)# no auto-summary

R2(config-router)# network 192.168.12.0

R2(config-router) #redistribute eigrp 1 //将 EIGRP 重分布到 RIP 中

R2(config-router)# default-metric 4 //配置默认种子度量值

【注意】

在“ redistribute”命令中用参数“ metric”指定的种子度量值优先于路由模式下使

用“ default-metric”命令设定的缺省的种子度量值。

(3)步骤 3:配置路由器 R3

R3(config)# router eigrp 1

R3(config-router)# no auto-summary

R3(config-router)# network 3.3.3.0 0.0.0.255

R3(config-router)# network 192.168.23.0

R3(config-router)# redistribute ospf 1 metric 1000 100 255 1 1500

//将 OSPF 重分布到 EIGRP 中

R3(config-router)# distance eigrp 90 150 //配置 EIGRP 默认管理距离

R3(config)# router ospf 1

R3(config-router)# router-id 3.3.3.3

R3(config-router)# network 192.168.34.0 0.0.0.255 area 0

R3(config-router)# redistribute eigrp 1 metric 30 metric-type 1 subnets

//将 EIGRP 重分布到 OSPF 中

R3(config-router)#d efault-information originate always

(4)步骤 4:配置路由器 R4

R4(config)# router ospf 1

R4(config-router)# router-id 4.4.4.4

R4(config-router)# network 4.4.4.0 0.0.0.255 area 0

R4(config-router)# network 192.168.34.0 0.0.0.255 area 0

4.实验调试

(1)在 R1 上查看路由表:

R1# show ip route

Codes: 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, 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

Gateway of last resort is 0.0.0.0 to network 0.0.0.0

C 192.168.12.0/24 is directly connected, Serial0/0/0

3.0.0.0/24 is subnetted, 1 subnets

R 3.3.3.0 [120/4] via 192.168.12.2, 00:00:08, Serial0/0/0

4.0.0.0/32 is subnetted, 1 subnets

R 4.4.4.4 [120/4] via 192.168.12.2, 00:00:08, Serial0/0/0

C 202.96.134.0/24 is directly connected, Serial0/0/1

R 192.168.23.0/24 [120/4] via 192.168.12.2, 00:00:08, Serial0/0/0

R 192.168.34.0/24 [120/4] via 192.168.12.2, 00:00:08, Serial0/0/0

R 192.168.23.0/24 [120/4] via 192.168.12.2, 00:00:08, Serial0/0/0

R 192.168.34.0/24 [120/4] via 192.168.12.2, 00:00:08, Serial0/0/0

S* 0.0.0.0/0 is directly connected, Serial0/0/1

以上输出表明路由器 R1 通过 RIPv2 学到从路由器 R2 重分布进 RIP 的路由。

(2)在 R2 上查看路由表:

R2# show ip route

Codes: 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, 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

Gateway of last resort is 192.168.12.1 to network 0.0.0.0

C 192.168.12.0/24 is directly connected, Serial0/0/0

3.0.0.0/24 is subnetted, 1 subnets

D 3.3.3.0 [90/2297856] via 192.168.23.3, 00:00:21, Serial0/0/1

4.0.0.0/32 is subnetted, 1 subnets

D EX 4.4.4.4 [170/3097600] via 192.168.23.3, 00:00:21, Serial0/0/1

C 192.168.23.0/24 is directly connected, Serial0/0/1

D EX 192.168.34.0/24 [170/3097600] via 192.168.23.3, 00:00:21, Serial0/0/1

R* 0.0.0.0/0 [120/3] via 192.168.12.1, 00:00:05, Serial0/0/0

D EX 192.168.34.0/24 [170/3097600] via 192.168.23.3, 00:00:21, Serial0/0/1

R* 0.0.0.0/0 [120/3] via 192.168.12.1, 00:00:05, Serial0/0/0

以上输出表明从路由器 R1 上重分布进 RIP 的默认路由被路由器 R2 学习到,路由代码为

“ R*”;在路由器 R3 上重分布进来的 OSPF 路由也被路由器 R2 学习到,路由代码为“ D EX”,

这也说明 EIGRP 能够识别内部路由和外部路由,默认的时候,内部路由的管理距离是 90,

外部路由的管理距离是 170。

(3)在 R3 上查看路由表:

R3# show ip route

Codes: 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, 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

Gateway of last resort is 192.168.23.2 to network 0.0.0.0

D EX 192.168.12.0/24 [150/3097600] via 192.168.23.2, 00:13:43, Serial0/0/1

3.0.0.0/24 is subnetted, 1 subnets

C 3.3.3.0 is directly connected, Loopback0

4.0.0.0/32 is subnetted, 1 subnets

O 4.4.4.4 [110/65] via 192.168.34.4, 00:13:43, Serial0/0/0

C 192.168.23.0/24 is directly connected, Serial0/0/1

C 192.168.34.0/24 is directly connected, Serial0/0/0

D*EX 0.0.0.0/0 [150/3097600] via 192.168.23.2, 00:06:08, Serial0/0/1

以上输出表明,从路由器 R2 上重分布进 EIGRP 的路由被路由器 R3 学习到,路由代码为

“ D*EX”,同时 EIGRP 外部路由的管理距离被修改成 150。

(4)在 R4 上查看路由表:

R4# show ip route

Codes: 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, 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

Gateway of last resort is 192.168.34.3 to network 0.0.0.0

O E1 192.168.12.0/24 [110/94] via 192.168.34.3, 00:25:26, Serial0/0/0

3.0.0.0/24 is subnetted, 1 subnets

O E1 3.3.3.0 [110/94] via 192.168.34.3, 00:25:26, Serial0/0/0

4.0.0.0/24 is subnetted, 1 subnets

C 4.4.4.0 is directly connected, Loopback0

O E1 192.168.23.0/24 [110/94] via 192.168.34.3, 00:25:26, Serial0/0/0

C 192.168.34.0/24 is directly connected, Serial0/0/0

O*E2 0.0.0.0/0 [110/1] via 192.168.34.3, 00:25:26, Serial0/0/0

以上输出表明,从路由器 R3 上重分布进 OSPF 的路由被路由器 R4 学习到,路由代码为

“ O E1”;同时学到由 R3 注入的路由代码为“ O E2”的默认路由。

(5) show ip protocols

R3# show ip protocols

Routing Protocol is " eigrp 1" // 运行 AS 为 1 的 EIGRP 进程

Outgoing update filter list for all interfaces is not set

Incoming update filter list for all interfaces is not set

Default networks flagged in outgoing updates

Default networks accepted from incoming updates

EIGRP metric weight K1=1, K2=0, K3=1, K4=0, K5=0

EIGRP maximum hopcount 100

EIGRP maximum metric variance 1

Redistributing: eigrp 1, ospf 1 (internal, external 1 & 2, nssa-external 1 & 2)

//将 OSPF 进程 1 重分布 EIGRP 中

EIGRP NSF-aware route hold timer is 240s

Automatic network summarization is not in effect

Maximum path: 4

Routing for Networks:

3.3.3.0/24

192.168.23.0

Routing Information Sources:

Gateway Distance Last Update

192.168.23.2 90 00:51:05

Distance: internal 90 external 150

Routing Protocol is " ospf 1" //运行 OSPF 进程,进程号为 1

Outgoing update filter list for all interfaces is not set

Incoming update filter list for all interfaces is not set

Router ID 3.3.3.3

It is an autonomous system boundary router //自治系统边界路由器(ASBR)

Redistributing External Routes from,

eigrp 1 with metric mapped to 30, includes subnets in redistribution

Redistributing External Routes from,

eigrp 1 with metric mapped to 30, includes subnets in redistribution

//将 EIGRP1 重分布 OSPF 中

Number of areas in this router is 1. 1 normal 0 stub 0 nssa

Maximum path: 4

Routing for Networks:

192.168.34.0 0.0.0.255 area 0

Routing Information Sources:

Gateway Distance Last Update

4.4.4.4 110 00:58:42

3.3.3.3 110 00:58:42

Distance: (default is 110)

以上输出表明路由器 R3 运行 EIGRP 和 OSPF 两种路由协议,而且实现了双向重分布。

以下是华为数通路由交换方向完整技术分享,欢迎对华为网络技术感兴趣的小伙伴们订阅。

【可在专栏中进行查看订阅】


华为新版HCIP数通路由交换

华为新版HCIE数通路由交换