天天看点

路由重分发

路由重发布

为什么要采用路由重发布?

在一个大型的企业网络中可能会采用不同的路由协议(rip,ospf,static),为了实现多种路由协议的协同工作,路由器可以通过路由的重分发将学到的一种路由协议重分发到另外的一种路由协议中,从而使得整个网络可以互相连通。

拓扑图:

路由重分发

R1路由重发布的配置:

r1#show running-config

Building configuration...

Current configuration : 919 bytes

version 12.4

no service timestamps log datetime msec

no service timestamps debug datetime msec

no service password-encryption

hostname r1

interface FastEthernet0/0

 ip address 192.168.3.1 255.255.255.0

 duplex auto

 speed auto

interface FastEthernet0/1

 ip address 192.168.1.2 255.255.255.0

!

interface Serial0/0/0

 ip address 192.168.4.1 255.255.255.0

 clock rate 9600

router ospf 1 ###在ospf路由协议中重新发布rip, connected,static等路由协议###

 log-adjacency-changes

 redistribute rip subnets

 redistribute static

 redistribute connected

 network 192.168.3.0 0.0.0.255 area 0

router rip###在rip路由协议中重新发布ospf, connected,static等路由协议###

 redistribute ospf 1 metric 3

 redistribute static metric 1

 redistribute connected metric 1

 network 192.168.1.0

ip classless

ip route 0.0.0.0 0.0.0.0 192.168.4.2

line con 0

line vty 0 4

login

路由未重发布前:

各路由器的路由表:

R0路由器

r0#show ip route

Codes: C - connected, S - static, I - IGRP, 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, E - EGP

       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 not set

C    192.168.1.0/24 is directly connected, FastEthernet0/1

C    192.168.2.0/24 is directly connected, Loopback0

r0#

R1路由器

r1#show ip route

Gateway of last resort is 192.168.4.2 to network 0.0.0.0

R    192.168.2.0/24 [120/1] via 192.168.1.1, 00:00:06, FastEthernet0/1rip学到的r0

C    192.168.3.0/24 is directly connected, FastEthernet0/0

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

     192.168.5.0/32 is subnetted, 1 subnets

O    192.168.5.1 [110/2] via 192.168.3.2, 00:23:05, FastEthernet0/0ospf学到的r2

S*   0.0.0.0/0 [1/0] via 192.168.4.2

r1#

R2路由器

r2#show ip rou

r2#show ip route

C    192.168.5.0/24 is directly connected, Loopback0

R3路由器

r3#show ip route

       * - candidate default, U - per-user static route, o - ODR

Gateway of last resort is 192.168.4.1 to network 0.0.0.0

C    192.168.6.0/24 is directly connected, Loopback0

S*   0.0.0.0/0 [1/0] via 192.168.4.1

路由重发布后:

R0路由器(发生变化)

Gateway of last resort is 192.168.1.2 to network 0.0.0.0

R    192.168.3.0/24 [120/3] via 192.168.1.2, 00:06:43, FastEthernet0/1 ospf

R    192.168.4.0/24 [120/1] via 192.168.1.2, 00:10:59, FastEthernet0/1直连

R    192.168.5.0/24 [120/3] via 192.168.1.2, 00:06:43, FastEthernet0/1 ospf

R*   0.0.0.0/0 [120/1] via 192.168.1.2, 00:10:41, FastEthernet0/1 静态

R1路由器(未发生变化)

R    192.168.2.0/24 [120/1] via 192.168.1.1, 00:00:14, FastEthernet0/1

O    192.168.5.1 [110/2] via 192.168.3.2, 00:43:15, FastEthernet0/0

R2路由器(发生变化)

O E2 192.168.1.0/24 [110/20] via 192.168.3.1, 00:09:45, FastEthernet0/0

O E2 192.168.2.0/24 [110/20] via 192.168.3.1, 00:09:12, FastEthernet0/0

O E2 192.168.4.0/24 [110/20] via 192.168.3.1, 00:09:45, FastEthernet0/0

r2#

r3#

测试连通性

R0---R2

 r0#ping 192.168.5.1

Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 192.168.5.1, timeout is 2 seconds:

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 62/62/63 ms

R0---R3

r0#ping 192.168.6.1

Sending 5, 100-byte ICMP Echos to 192.168.6.1, timeout is 2 seconds:

Success rate is 100 percent (5/5), round-trip min/avg/max = 47/59/63 ms

R3---R0

r3#ping 192.168.2.1

Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:

Success rate is 100 percent (5/5), round-trip min/avg/max = 48/59/63 ms

R3---R2

r3#ping 192.168.5.1

Success rate is 100 percent (5/5), round-trip min/avg/max = 62/65/79 ms

R2---R0

r2#ping 192.168.2.1

Success rate is 100 percent (5/5), round-trip min/avg/max = 46/58/62 ms

R2---R3(没有ping同不知道为什么,静态路由没有学习到)哪位大虾请教下

r2#ping 192.168.6.1

.....

Success rate is 0 percent (0/5)

解决办法:在r2上面配置一条默认路由

ip route 0.0.0.0 0.0.0.0 192.168.3.1

再次测试:

R2---R3(ping同)

后续:在R0路由器中

router ospf 1 ###在ospf路由协议中重新发布rip, connected,static等路由协议###

default-information originate 增加这一条

然后查看:

r2#show ip route 

       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, E - EGP

       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.3.1 to network 0.0.0.0

O E2 192.168.1.0/24 [110/20] via 192.168.3.1, 00:18:28, FastEthernet0/0

O E2 192.168.2.0/24 [110/20] via 192.168.3.1, 00:18:28, FastEthernet0/0

C    192.168.3.0/24 is directly connected, FastEthernet0/0

O E2 192.168.4.0/24 [110/20] via 192.168.3.1, 00:18:28, FastEthernet0/0

C    192.168.5.0/24 is directly connected, Loopback0

O*E2 0.0.0.0/0 [110/1] via 192.168.3.1, 00:00:30, FastEthernet0/0

 资料下载地址:http://down.51cto.com/data/547622