静态路由的缺点是,必须手工配置,同时在网络拓扑变化后需要手工更新;动态路由的缺点是,它们需要占用网络带宽和路由器资源。在包含数百个分支站点的中央-分支网络,采用静态路由时配置工作量将非常大,而采用动态路由时将占用大量的资源。 在这种情况下,我们采用第三种方式——按需路由(ODR,On Demand Routing)。ODR是Cisco的私有协议,它使用CDP在分支路由器和中央路由器之间传输网络信息。它的优点是,比动态路由协议开销小得多,比静态路由协议配置量少得多。而它的缺点就是,只适合于中央-分支拓扑。 在中央路由器的全局模式下使用router odr命令来启用ODR。 下面是ODR配置示例:
R1配置如下: R1#sh run Building configuration...
Current configuration : 1289 bytes version 12.4 service timestamps debug datetime msec service timestamps log datetime msec service password-encryption
hostname R1
boot-start-marker boot-end-marker
enable secret 5 $1$xGcB$Oir1JjPzZdoLL4wxA7kPH1
aaa new-model
aaa authentication login default local
aaa session-id common no ip icmp rate-limit unreachable
ip cef no ip domain lookup
username cisco password 7 091D1C5A4D5041
ip tcp synwait-time 5
interface FastEthernet0/0 ip address 192.168.1.1 255.255.255.252 duplex auto speed auto
interface FastEthernet0/1 ip address 192.168.1.5 255.255.255.252 duplex auto speed auto
interface Serial1/0 no ip address shutdown serial restart-delay 0
interface Serial1/1 no ip address shutdown serial restart-delay 0
interface Serial1/2 no ip address shutdown serial restart-delay 0
interface Serial1/3 no ip address shutdown serial restart-delay 0
router odr //配置ODR
no ip http server no ip http secure-server
no cdp log mismatch duplex
control-plane
gatekeeper shutdown
line con 0 exec-timeout 0 0 privilege level 15 logging synchronous no exec stopbits 1 line aux 0 exec-timeout 0 0 privilege level 15 logging synchronous stopbits 1 line vty 0 4
end
R2的配置如下: R2#sh run Building configuration...
Current configuration : 1319 bytes
version 12.4 service timestamps debug datetime msec service timestamps log datetime msec service password-encryption
hostname R2
boot-start-marker boot-end-marker
enable secret 5 $1$AOeH$KIuGrBL.TNS1Iwe0Kt8Bd0
aaa new-model
aaa authentication login default local
aaa session-id common no ip icmp rate-limit unreachable
ip cef no ip domain lookup
username cisco password 7 00554155500E5D
ip tcp synwait-time 5
interface Loopback0 ip address 2.2.2.2 255.255.255.255
interface FastEthernet0/0 ip address 192.168.1.2 255.255.255.252 duplex auto speed auto
interface FastEthernet0/1 no ip address shutdown duplex auto speed auto
interface Serial1/0 no ip address shutdown serial restart-delay 0
interface Serial1/1 no ip address shutdown serial restart-delay 0
interface Serial1/2 no ip address shutdown serial restart-delay 0
interface Serial1/3 no ip address shutdown serial restart-delay 0
no ip http server no ip http secure-server
no cdp log mismatch duplex
control-plane
gatekeeper shutdown
line con 0 exec-timeout 0 0 privilege level 15 logging synchronous no exec stopbits 1 line aux 0 exec-timeout 0 0 privilege level 15 logging synchronous stopbits 1 line vty 0 4
end
R3的配置如下: R3#sh run Building configuration...
*May 5 19:44:13.907:%SYS-5-CONFIG_I: Configured from console by console Current configuration : 1319 bytes
version 12.4 service timestamps debug datetime msec service timestamps log datetime msec service password-encryption
hostname R3
boot-start-marker boot-end-marker
enable secret 5 $1$nkGN$k3DeFEbRxkr8ILTnGTpDu/
aaa new-model
aaa authentication login default local
aaa session-id common no ip icmp rate-limit unreachable
ip cef no ip domain lookup
username cisco password 7 075E731F1A5C4F
ip tcp synwait-time 5
interface Loopback0 ip address 3.3.3.3 255.255.255.255
interface FastEthernet0/0 no ip address shutdown duplex auto speed auto
interface FastEthernet0/1 ip address 192.168.1.6 255.255.255.252 duplex auto speed auto
interface Serial1/0 no ip address shutdown serial restart-delay 0
interface Serial1/1 no ip address shutdown serial restart-delay 0
interface Serial1/2 no ip address shutdown serial restart-delay 0
interface Serial1/3 no ip address shutdown serial restart-delay 0
no ip http server no ip http secure-server
no cdp log mismatch duplex
control-plane
gatekeeper shutdown
line con 0 exec-timeout 0 0 privilege level 15 logging synchronous no exec stopbits 1 line aux 0 exec-timeout 0 0 privilege level 15 logging synchronous stopbits 1 line vty 0 4
end
用R2去ping R3,测试连通性: R2#ping 3.3.3.3 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 60/62/64ms
查看R1的路由表: R1#sh ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRPexternal, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA externaltype 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type1, E2 - OSPF external type 2 i - IS-IS, su - IS-ISsummary, 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 - periodicdownloaded static route
Gateway of last resort is not set
2.0.0.0/32 is subnetted,1 subnets o 2.2.2.2 [160/1] via192.168.1.2, 00:00:22, FastEthernet0/0 3.0.0.0/32 is subnetted,1 subnets o 3.3.3.3 [160/1] via192.168.1.6, 00:00:27, FastEthernet0/1 192.168.1.0/30 issubnetted, 2 subnets C 192.168.1.0 isdirectly connected, FastEthernet0/0 C 192.168.1.4 isdirectly connected, FastEthernet0/1
查看R2的路由表: R2#sh ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRPexternal, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA externaltype 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPFexternal type 2 i - IS-IS, su - IS-ISsummary, 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 - periodicdownloaded static route
Gateway of last resort is 192.168.1.1 to network 0.0.0.0
2.0.0.0/32 is subnetted,1 subnets C 2.2.2.2 is directlyconnected, Loopback0 192.168.1.0/30 issubnetted, 1 subnets C 192.168.1.0 isdirectly connected, FastEthernet0/0 o* 0.0.0.0/0 [160/1] via 192.168.1.1, 00:00:16, FastEthernet0/0
查看R3的路由表: R3#sh ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRPexternal, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA externaltype 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type1, E2 - OSPF external type 2 i - IS-IS, su - IS-ISsummary, 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 - periodicdownloaded static route
Gateway of last resort is 192.168.1.5 to network 0.0.0.0
3.0.0.0/32 is subnetted,1 subnets C 3.3.3.3 is directlyconnected, Loopback0 192.168.1.0/30 issubnetted, 1 subnets C 192.168.1.4 isdirectly connected, FastEthernet0/1 o* 0.0.0.0/0 [160/1] via 192.168.1.5, 00:00:45, FastEthernet0/1
|