假设总部和分支机构使用的都是思科设备,其实不用太复杂的命令配置,开了CDP之后,仅需要一条命令就可以在分支路由器上自动生成静态路由,下面就来看看具体是怎么实施的吧!~
一. 实验目的
使用ODR实现按需路由。
ODR能够使hub and spoke网络结构中的hub路由器自动地向spoke路由器(又称为stub站点)提供缺省路由,stub站点路由器不需要运行动态路由协议,也不需要 配置任何的静态路由,几乎没有系统资源的占用,就能够实现本地所有的直连子网向hub路由器的自动通告.
二. 实验拓扑
三. 配置要点
R6(config)#router odr
(仅需在全局配置模式使用此命令即可)
四. 验证结果
用debug可以看到学习的过程:
R6#debug cdp packets
CDP packet info debugging is on
R6#
01:05:23: CDP-PA: version 2 packet sent out on Serial0/1
01:05:23: CDP-PA: version 2 packet sent out on Serial0/2
01:05:23: CDP-PA: version 2 packet sent out on Serial0/3
01:05:34: CDP-PA: Packet received from R1 on interface Serial0/1
01:05:34: **Entry found in cache**
01:05:34: CDP-PA: Packet received from R2 on interface Serial0/2
01:05:34: **Entry found in cache**
01:05:41: CDP-PA: Packet received from R3 on interface Serial0/3
01:05:41: **Entry found in cache**
可以查看四台路由器,观察路由表的变化:
R6#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
o 1.1.1.0 [160/1] via 11.11.11.1, 00:00:49, Serial0/1
2.0.0.0/24 is subnetted, 1 subnets
o 2.2.2.0 [160/1] via 22.22.22.2, 00:00:49, Serial0/2
33.0.0.0/24 is subnetted, 1 subnets
C 33.33.33.0 is directly connected, Serial0/3
3.0.0.0/24 is subnetted, 1 subnets
o 3.3.3.0 [160/1] via 33.33.33.3, 00:00:42, Serial0/3
22.0.0.0/24 is subnetted, 1 subnets
C 22.22.22.0 is directly connected, Serial0/2
11.0.0.0/24 is subnetted, 1 subnets
C 11.11.11.0 is directly connected, Serial0/1
R1#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
o - ODR, P - periodic downloaded static route
Gateway of last resort is 11.11.11.6 to network 0.0.0.0
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
11.0.0.0/24 is subnetted, 1 subnets
C 11.11.11.0 is directly connected, Serial0/1
o* 0.0.0.0/0 [160/1] via 11.11.11.6, 00:00:27, Serial0/1
R1#
R2#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
o - ODR, P - periodic downloaded static route
Gateway of last resort is 22.22.22.6 to network 0.0.0.0
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Loopback0
22.0.0.0/24 is subnetted, 1 subnets
C 22.22.22.0 is directly connected, Serial0/2
o* 0.0.0.0/0 [160/1] via 22.22.22.6, 00:00:13, Serial0/2
R2#
R3#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
o - ODR, P - periodic downloaded static route
Gateway of last resort is 33.33.33.6 to network 0.0.0.0
33.0.0.0/24 is subnetted, 1 subnets
C 33.33.33.0 is directly connected, Serial0/3
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
o* 0.0.0.0/0 [160/1] via 33.33.33.6, 00:00:36, Serial0/3