ODR on demand routing  CISCO按需路由技术

1.简介

ODR使用Cisco发现协议CDP来在末节路由器和中央路由器之间传输网络信息。与动态路由协议相比,ODR提供IP路由信息的开销非常小;而与静态路由相比,ODR的手工配置量更少。

2.原理

ODR只适合用于中央--分支拓扑。在这种拓扑中,每台分支路由器只与中央路由器建立邻接关系。分支路由器也称为末节路由器。末节路由器可能连接了几个LAN,但通常只有一条到中央路由器的WAN连接。中央路由器需要获悉每台分支路由器连接的网络,而分支路由器只需一条指向中央路由器的默认路由。在星形网络中,中央结点使用ODR技术,中央路由器将提条指向自己的默认路由发送给分支路由器,并将ODR报告的末节网络加入到路由表中,实现通信。ODR只须对中央路由器进行配置,使之将这些网络重分发给动态路由协议。

注意:该技术需要路由器开启CDP,ODR只适用于CISCO设备构建的网络。因为网络网段 ,子网掩码等使用的是CDP,并不含度量值 。所以ODR并不是严格意义上的动态路由选择协议 。

3.简单配置

这是一种简单的中央--分支拓扑结构。R1为中央路由器,R2,R3分别为末节路由器。R2,R3分别连接了若干个LAN。只须对中央路由器R1进行CDP的配置,R2,R3分别指向默认路由。

按需路由 ODR_路由器

                                     R1

R1#config t
R1(config)#line co 0 
R1(config-line)#logg synchronous 
R1(config-line)#login local 
R1(config-line)#exec-timeout 0 0 
R1(config-line)#no ip domain-lookup
R1(config)#username ccna privilege 15 secret cisco

R1(config)#enable secret cisco

R1(config)#interface fastEthernet 1/0

R1(config-if)#ip add 12.1.1.1 255.255.255.0
R1(config-if)#no shutdown 

R1(config)#interface fastEthernet 1/1
R1(config-if)#ip address 21.1.1.1 255.255.255.0
R1(config-if)#no shutdown 

R1(config-if)#exit

R1(config)#router odr
R1(config-router)#network 12.1.1.0
R1(config-router)#network 21.1.1.0

 

                                    R2

R2#config t
R2(config)#line co 0 
R2(config-line)#logg synchronous 
R2(config-line)#login local 
R2(config-line)#exec-timeout 0 0 
R2(config-line)#no ip domain-lookup
R2(config)#username ccna privilege 15 secret cisco
R2(config)#enable secret cisco

R2(config)#interface fa1/0
R2(config-if)#ip address 12.1.1.2 255.255.255.0
R2(config-if)#no shutdown 

R2(config)#interface loopback 0
R2(config-if)#ip address 1.1.1.1 255.255.255.0

 

                                             R3

R3#config t
R3(config)#line co 0 
R3(config-line)#logg synchronous 
R3(config-line)#login local 
R3(config-line)#exec-timeout 0 0 
R3(config-line)#no ip domain-lookup
R3(config)#username ccna privilege 15 secret cisco

R3(config)#enable secret cisco

R3(config)#interface fa1/0
R3(config-if)#ip address 21.1.1.2 255.255.255.0
R3(config-if)#no shutdown

R3(config)#interface loopback 0
R3(config-if)#ip address 2.2.2.2 255.255.255.0

 

查看R1的路由表:

R1#show ip route

     1.0.0.0/24 is subnetted, 1 subnets
o       1.1.1.0 [160/1] via 12.1.1.2, 00:00:21, FastEthernet1/0
     2.0.0.0/24 is subnetted, 1 subnets
o       2.2.2.0 [160/1] via 21.1.1.2, 00:00:44, FastEthernet1/1
     21.0.0.0/24 is subnetted, 1 subnets
C       21.1.1.0 is directly connected, FastEthernet1/1
     12.0.0.0/24 is subnetted, 1 subnets

C       12.1.1.0 is directly connected, FastEthernet1/0

 

o字符标识,标识ODR。在这个例子中,路由的度量值为1,管理距离为160.可以看出网路全通。

查看R2的路由表:

R2#show ip route 

     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
     12.0.0.0/24 is subnetted, 1 subnets
C       12.1.1.0 is directly connected, FastEthernet1/0

o*   0.0.0.0/0 [160/1] via 12.1.1.1, 00:00:04, FastEthernet1/0

 

o*标识缺省路由。末节路由器有一个指向中央路由器的缺省路由。在此例中,指向R1的fa1/0口。数据全部通过这个口到达R1路由器。

 

验证:

R1#ping 1.1.1.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!!!

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

 

通过验证,全网可以互通。

 

 

此命令还可以查看cdp的详细设置

R1#show cdp interface 
FastEthernet0/0 is administratively down, line protocol is down
  Encapsulation ARPA
  Sending CDP packets every 60 seconds
  Holdtime is 180 seconds
FastEthernet1/0 is up, line protocol is up
  Encapsulation ARPA
  Sending CDP packets every 60 seconds
  Holdtime is 180 seconds
FastEthernet1/1 is up, line protocol is up
  Encapsulation ARPA
  Sending CDP packets every 60 seconds

  Holdtime is 180 seconds

可以看出,默认情况下,CDP更新每隔60s发送一次。保持等待时间为180s。