搜档网
当前位置:搜档网 > 路由的重分布

路由的重分布

配置基本的路由重分布

路由重分布的意思就是比如说RouterA和RouterB配两个不同的动态路由协议,他们之间是没有LSA的,要想在router上有对方的LSA就要做重发布。一般来说一个组织或者一个跨国公司很少只使用一个路由协议,而如果一个公司同时运行了多个路由协议,或者一个公司和另外一个公司合并的时候两个公司用的路由协议并不一样,这个时候该怎么办呢?所以必须重发布来将一个路由协议的信息发布到另外的一个路由协议里面去。重发布只能在针对同一种第三层协议的路由选择进程之间进行,也就是说,OSPF,RIP,IGRP等之间可以重发布,因为他们都属于TCP/IP协议栈的协议

路由的重分布

路由的重分布

路由的重分布

RIP与静态路由的重分布配置

如上例图所示:“RIP与OSPF路由重分布例子”

switchA(config)#router rip

switchA(config-router)#network 192.168.10.0

switchA(config-router)#network 192.168.20.0

switchA(config-router)#network 192.168.1.0

switchA(config-router)#version 2

switchA(config-router)#no auto-summary

switchA(config-router)#exit

Router(config)#router rip

Router(config-router)#network 192.168.1.0

Router(config-router)#network 192.168.2.0

Router(config-router)#version 2

Router(config-router)#no auto-summary

Router(config-router)#exit

Router(config)#ip route 192.168.30.0 255.255.255.0 192.168.2.1 Router(config)#ip route 192.168.40.0 255.255.255.0 192.168.2.1 Router(config)#end

switchB(config)#ip route 192.168.10.0 255.255.255.0 192.168.2.2 switchB(config)#ip route 192.168.20.0 255.255.255.0 192.168.2.2 switchB(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.2 switchB(config)#end

在互连路由器上进行重分布配置,使其两个不同路由协议的网络进行互通Router(config)#router rip

Router(config-router)#redistribute static Subnet//将RIP重分布到静态路由当中

Router(config-router)#exit

Router(config)#end

此例我只是做了把RIP重分布到静态路由,是因为静态路由本身就是一个明确的邻接路由,因为我们在switchB上已经明确指定静态路由了,所以就没有做相关的重分布配置,话说过来,网络设备也没有提供相就的静态路由重分布的方法。

配置边界路由器传输缺省路由到RIPv2。记住:为了让其它RIPv2的路由器学习到缺省路由,RIPv2需要配置一条静态缺省路由。

配置好后:三台设备的路由表情况如下:

Router:

Router#show ip route

Codes: C - connected, S - static, R - RIP B - BGP

O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external typ e 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

Gateway of last resort is no set

C 192.168.1.0/24 is directly connected, FastEthernet 0/0

C 192.168.1.2/32 is local host.

C 192.168.2.0/24 is directly connected, FastEthernet 0/1

C 192.168.2.2/32 is local host.

R 192.168.10.0/24 [120/1] via 192.168.1.1, 00:00:15, FastEthernet 0/0

R 192.168.20.0/24 [120/1] via 192.168.1.1, 00:00:15, FastEthernet 0/0

S 192.168.30.0/24 [1/0] via 192.168.2.1

S 192.168.40.0/24 [1/0] via 192.168.2.1

switchA:

switchA#show ip route

Codes: C - connected, S - static, R - RIP B - BGP

O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external typ e 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

Gateway of last resort is no set

C 192.168.1.0/24 is directly connected, FastEthernet 0/1

C 192.168.1.1/32 is local host.

C 192.168.10.0/24 is directly connected, VLAN 10

C 192.168.10.1/32 is local host.

C 192.168.20.0/24 is directly connected, VLAN 20

C 192.168.20.1/32 is local host.

R 192.168.30.0/24[120/1] via 192.168.1.2, 00:00:15, FastEthernet 0/0

R 192.168.40.0/24[120/1] via 192.168.1.2, 00:00:15, FastEthernet 0/0

R 192.168.2.0/24 [120/1] via 192.168.1.2, 00:00:15, FastEthernet 0 /0

switchB:

switchB#show ip route

Codes: C - connected, S - static, R - RIP B - BGP

O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external typ e 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

Gateway of last resort is no set

C 192.168.2.0/24 is directly connected, FastEthernet 0/1

C 192.168.2.1/32 is local host.

S 192.168.10.0/24 [1/0] via 192.168.2.2

S 192.168.20.0/24 [1/0] via 192.168.2.2

S 192.168.1.0/24 [1/0] via 192.168.2.2

C 192.168.40.0/24 is directly connected, VLAN 20

C 192.168.40.1/32 is local host.

根据上述的路由表的分析我们得知rip与static的路由重分布成功。

路由的重分布

路由的重分布

OSPF与静态路由分布配置

如上例图所示:“RIP与OSPF路由重分布例子”

switchA(config)#router ospf 10

switchA(config-router)#network 192.168.10.0 0.0.0.255 area 0 switchA(config-router)#network 192.168.20.0 0.0.0.255 area 0 switchA(config-router)#network 192.168.1.0 0.0.0.255 area 0 switchA(config-router)#exit

switchA(config)#end

router(config)#router ospf 10

router(config-router)#network 192.168.1.0 0.0.0.255 area 0 router(config-router)#network 192.168.2.0 0.0.0.255 area 0 router(config-router)#exit

router(config)#ip route 192.168.30.0 255.255.255.0 192.168.2.1 router(config)#ip route 192.168.40.0 255.255.255.0 192.168.2.1 router(config)#end

switchB(config)#ip route 192.168.10.0 255.255.255.0 192.168.2.2 switchB(config)#ip route 192.168.20.0 255.255.255.0 192.168.2.2 switchB(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1 switchB(config)#end

在互连路由器上进行重分布配置,使其两个不同路由协议的网络进行互通Router(config)#router ospf 10

Router(config-router)#redistribute static subnets //将OSPF重分布到静态路由

Router(config-router)#exit

Router(config)#end

此例我只是做了把OSPF重分布到静态路由,是因为静态路由本身就是一个明确的邻接路由,因为我们在switchB上已经明确指定静态路由了,所以就没有做相关的重分布配置,话说过来,网络设备也没有提供相就的静态路由重分布的方法。

配置好后:三台设备的路由表情况如下:

Router:

Router#show ip route

Codes: C - connected, S - static, R - RIP B - BGP

O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external typ e 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

Gateway of last resort is no set

C 192.168.1.0/24 is directly connected, FastEthernet 0/0

C 192.168.1.2/32 is local host.

C 192.168.2.0/24 is directly connected, FastEthernet 0/1

C 192.168.2.2/32 is local host.

O 192.168.10.0/24 [110/2] via 192.168.1.2, 1d,22:44:08, FastEther net 0/0

O 192.168.20.0/24 [110/2] via 192.168.1.2, 1d,22:44:08, FastEther net 0/0

S 192.168.30.0/24 [1/0] via 192.168.2.1

S 192.168.40.0/24 [1/0] via 192.168.2.1

switchA:

switchA#show ip route

Codes: C - connected, S - static, R - RIP B - BGP

O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external typ e 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

Gateway of last resort is no set

C 192.168.1.0/24 is directly connected, FastEthernet 0/1

C 192.168.1.1/32 is local host.

C 192.168.10.0/24 is directly connected, VLAN 10

C 192.168.10.1/32 is local host.

C 192.168.20.0/24 is directly connected, VLAN 20

C 192.168.20.1/32 is local host.

O 192.168.30.0/24 [110/2] via 192.168.1.2, 1d,22:44:08, FastEther net 0/0

O 192.168.40.0/24[110/2] via 192.168.1.2, 1d,22:44:08, FastEther net 0/0

O 192.168.2.0/24 [110/2] via 192.168.1.2, 1d,22:44:08, FastEthern et 0/0

switchB:

switchB#show ip route

Codes: C - connected, S - static, R - RIP B - BGP

O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external typ e 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

Gateway of last resort is no set

C 192.168.2.0/24 is directly connected, FastEthernet 0/1

C 192.168.2.1/32 is local host.

S 192.168.10.0/24 [1/0] via 192.168.2.2

S 192.168.20.0/24 [1/0] via 192.168.2.2

S 192.168.1.0/24 [1/0] via 192.168.2.2

C 192.168.40.0/24 is directly connected, VLAN 20

C 192.168.40.1/32 is local host.

根据上述的路由表的分析我们得知OSPF与static的路由重分布成功。

路由的重分布

路由的重分布

路由的重分布

OSPF与RIP路由重分布配置,使用重分布列表,对分布的路由进行控制的配置

如上例图所示:“RIP与OSPF路由重分布例子”

switchA(config)#router rip

switchA(config-router)#network 192.168.10.0

switchA(config-router)#network 192.168.20.0

switchA(config-router)#network 192.168.1.0

switchA(config-router)#version 2

switchA(config-router)#no auto-summary

switchA(config-router)#exit

switchA(config)#end

router(config)#router rip

router(config-router)#network 192.168.1.0

router(config-router)#network 192.168.2.0

router(config-router)#version 2

router(config-router)#no auto-summary

router(config-router)#redistribute ospf metric 2//设置路由重分布,将rip 重分布到ospf中

router(config-router)#exit

router(config)#router ospf 10

router(config-router)#network 192.168.1.0 0.0.0.255 area 0

router(config-router)#network 192.168.2.0 0.0.0.255 area 0

router(config-router)#redistriblute rip subnets//设置路由重分布,将ospf 重分布到rip中

router(config-router)#exit

router(config)#end

switchB(config)#router ospf 10

switchB(config-router)#network 192.168.30.0 0.0.0.255 area 0

switchB(config-router)#network 192.168.40.0 0.0.0.255 area 0

switchB(config-router)#network 192.168.2.0 0.0.0.255 area 0

switchB(config-router)#exit

在没有设置重分布列表之前三台设备的路由如下:

Router:

Router#show ip route

Codes: C - connected, S - static, R - RIP B - BGP

O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external typ e 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

Gateway of last resort is no set

C 192.168.1.0/24 is directly connected, FastEthernet 0/0

C 192.168.1.2/32 is local host.

C 192.168.2.0/24 is directly connected, FastEthernet 0/1

C 192.168.2.2/32 is local host.

R 192.168.10.0/24 [120/1] via 192.168.1.1, 00:00:15, FastEthernet 0/0

R 192.168.20.0/24 [120/1] via 192.168.1.1, 00:00:15, FastEthernet 0/0

O 192.168.30.0/24 [110/2] via 192.168.2.1, 1d,22:44:08, FastEther net 0/1

O 192.168.40.0/24 [110/2] via 192.168.2.1, 1d,22:44:08, FastEther net 0/1

switchA:

switchA#show ip route

Codes: C - connected, S - static, R - RIP B - BGP

O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external typ e 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

Gateway of last resort is no set

C 192.168.1.0/24 is directly connected, FastEthernet 0/1

C 192.168.1.1/32 is local host.

C 192.168.10.0/24 is directly connected, VLAN 10

C 192.168.10.1/32 is local host.

C 192.168.20.0/24 is directly connected, VLAN 20

C 192.168.20.1/32 is local host.

R 192.168.30.0/24[120/2] via 192.168.1.2, 00:00:15, FastEthernet 0/0

R 192.168.40.0/24[120/2] via 192.168.1.2, 00:00:15, FastEthernet 0/0

R 192.168.2.0/24 [120/1] via 192.168.1.2, 00:00:15, FastEthernet 0 /0

switchB:

switchB#show ip route

Codes: C - connected, S - static, R - RIP B - BGP

O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external typ e 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

Gateway of last resort is no set

C 192.168.2.0/24 is directly connected, FastEthernet 0/1

C 192.168.2.1/32 is local host.

O E2 192.168.10.0/24 [110/20] via 192.168.2.2, 1d,22:42:49, FastEthe rnet 0/1

O E2 192.168.20.0/24 [110/20] via 192.168.2.2, 1d,22:42:49, FastEthe rnet 0/1

O E2 192.168.1.0/24 [110/20] via 192.168.2.2, 1d,22:42:49, FastEther net 0/1

C 192.168.40.0/24 is directly connected, VLAN 20

C 192.168.40.1/32 is local host.

根据上述的路由表的分析我们得知rip与OSPF的路由重分布成功。

配置重分布列表

可以得知,当没有配置重分布列表时,用户是无法控制路由重分布路由的条数,下面让我们来配置重分布列表,看一下有什么变化:

Router(config)#access-list 10 permit 192.168.10.0 0.0.0.255

Router(config)#router rip

Router(config)#distribute-list 10 out ospf //配置重分布任务列表10当中的允许匹配源路由的路由重分布到OSPF当中。

这时再观察三台设备的路由表情况:

Router:

Router#show ip route

Codes: C - connected, S - static, R - RIP B - BGP

O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external typ e 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

Gateway of last resort is no set

C 192.168.1.0/24 is directly connected, FastEthernet 0/0

C 192.168.1.2/32 is local host.

C 192.168.2.0/24 is directly connected, FastEthernet 0/1

C 192.168.2.2/32 is local host.

R 192.168.10.0/24 [120/1] via 192.168.1.1, 00:00:15, FastEthernet 0/0

R 192.168.20.0/24 [120/1] via 192.168.1.1, 00:00:15, FastEthernet 0/0

O 192.168.30.0/24 [110/2] via 192.168.2.1, 1d,22:44:08, FastEther net 0/1

O 192.168.40.0/24 [110/2] via 192.168.2.1, 1d,22:44:08, FastEther net 0/1

switchA:

switchA#show ip route

Codes: C - connected, S - static, R - RIP B - BGP

O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external typ e 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

Gateway of last resort is no set

C 192.168.1.0/24 is directly connected, FastEthernet 0/1

C 192.168.1.1/32 is local host.

C 192.168.10.0/24 is directly connected, VLAN 10

C 192.168.10.1/32 is local host.

C 192.168.20.0/24 is directly connected, VLAN 20

C 192.168.20.1/32 is local host.

R 192.168.30.0/24 [120/1] via 192.168.1.2, 00:00:15, FastEthernet 0/0

R 192.168.40.0/24 [120/1] via 192.168.1.2, 00:00:15, FastEthernet 0/0

R 192.168.2.0/24 [120/1] via 192.168.1.2, 00:00:15, FastEthernet 0 /0

switchB:

switchB#show ip route

Codes: C - connected, S - static, R - RIP B - BGP

O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external typ e 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

Gateway of last resort is no set

C 192.168.2.0/24 is directly connected, FastEthernet 0/1

C 192.168.2.1/32 is local host.

O E2 192.168.10.0/24 [110/20] via 192.168.2.2, 1d,22:42:49, FastEthe rnet 0/1

O E2 192.168.1.0/24 [110/20] via 192.168.2.2, 1d,22:42:49, FastEther net 0/1

C 192.168.40.0/24 is directly connected, VLAN 20

C 192.168.40.1/32 is local host.

从路由表中可以得知,此时switchB路由表只有switchA的192.168.10.0这条路由,而没有switchA的其他路由,这就控制路由的通告控制.

OSPF、EIGRP、RIP、静态路由的重分布综合试验

.net文件就不发了,简单的直连。看下R2、R4、R5的sh run文件和路由表R2的核心配置文件interface FastEthernet0/0 ip address 192.168.1.2 255.255.255.0 duplex auto speed auto ! interface FastEthernet0/1 ip address 192.168.2.1 255.255.255.0 duple

路由的重分布

.net文件就不发了,简单的直连。

看下R2、R4、R5的sh run文件和路由表R2的核心配置文件

interface FastEthernet0/0

ip address 192.168.1.2 255.255.255.0 duplex auto

speed auto

!

interface FastEthernet0/1

ip address 192.168.2.1 255.255.255.0 duplex auto

speed auto

!

router ospf 100

log-adjacency-changes

redistribute rip subnets

network 192.168.2.0 0.0.0.255 area 0 !

router rip

redistribute ospf 100

network 192.168.1.0

default-metric 2

R4的核心配置

interface FastEthernet0/0

ip address 192.168.3.2 255.255.255.0 duplex auto

speed auto

!

interface FastEthernet0/1

ip address 192.168.4.1 255.255.255.0

duplex auto

speed auto

!

router eigrp 100

redistribute ospf 100

network 192.168.4.0

default-metric 1000 10 1 255 1500

auto-summary

!

router ospf 100

log-adjacency-changes

redistribute eigrp 100 subnets

network 192.168.3.0 0.0.0.255 area 0

default-metric 64

R5的核心配置

interface FastEthernet0/0

ip address 192.168.5.1 255.255.255.0

duplex auto

speed auto

!

interface FastEthernet0/1

ip address 192.168.4.2 255.255.255.0

duplex auto

speed auto

!

router eigrp 100

network 6.6.6.6 0.0.0.0

network 192.168.4.0

network 192.168.5.0

auto-summary

!

router ospf 100

log-adjacency-changes

no auto-cost

!

ip classless

ip route 6.6.6.6 255.255.255.255 FastEthernet0/0 R2的路由表

R 1.0.0.0/8 [120/1] via 192.168.1.1, 00:00:26, FastEthernet0/0

6.0.0.0/32 is subnetted, 1 subnets

O E2 6.6.6.6 [110/64] via 192.168.2.2, 00:10:28, FastEthernet0/1

O E2 192.168.4.0/24 [110/64] via 192.168.2.2, 00:36:14, FastEthernet0/1

O E2 192.168.5.0/24 [110/64] via 192.168.2.2, 00:09:24, FastEthernet0/1

C 192.168.1.0/24 is directly connected, FastEthernet0/0

C 192.168.2.0/24 is directly connected, FastEthernet0/1

O 192.168.3.0/24 [110/2] via 192.168.2.2, 00:37:01, FastEthernet0/1

R4的路由表

O E2 1.0.0.0/8 [110/20] via 192.168.3.1, 00:37:36, FastEthernet0/0

6.0.0.0/32 is subnetted, 1 subnets

D 6.6.6.6 [90/30720] via 192.168.4.2, 00:11:03, FastEthernet0/1

C 192.168.4.0/24 is directly connected, FastEthernet0/1

D 192.168.5.0/24 [90/30720] via 192.168.4.2, 00:09:59, FastEthernet0/1 O E2 192.168.1.0/24 [110/20] via 192.168.3.1, 00:37:36, FastEthernet0/0

O 192.168.2.0/24 [110/2] via 192.168.3.1, 00:37:36, FastEthernet0/0

C 192.168.3.0/24 is directly connected, FastEthernet0/0

R5的路由表

D EX 1.0.0.0/8 [170/2565120] via 192.168.4.1, 00:36:35, FastEthernet0/1

6.0.0.0/32 is subnetted, 1 subnets

S 6.6.6.6 is directly connected, FastEthernet0/0

C 192.168.4.0/24 is directly connected, FastEthernet0/1

C 192.168.5.0/24 is directly connected, FastEthernet0/0

D EX 192.168.1.0/24 [170/2565120] via 192.168.4.1, 00:36:35, FastEthernet0/1 D EX 192.168.2.0/24 [170/2565120] via 192.168.4.1, 00:36:35, FastEthernet0/1 D EX 192.168.3.0/24 [170/2565120] via 192.168.4.1, 00:36:35, FastEthernet0/1

相关文档
  • 路由重分布配置

  • 路由重分布实验

  • 路由器重分布

  • 路由重分发配置