——路由器获悉远程网络的方式有两种:管理员手工配置信息(路由静态选择)路由器从其他路由器获取信息(动态路由协议)。
——静态路由适合于中央——分支拓扑中。
——如果目标网络未出现在路由选择表中,路由器将使用默认路由。
管理员手工配置:
在
A
路由器上设置默认路由指向路由器
B
;
IP ROUTE 0.0.0.0 0.0.0.0 10.1.1.1
在
B
路由器上设置到
A
路由器的静态路由;
IP ROUTE 172.16.1.0 255.255.255.0 S0/0/0
在
B
路由器上默认路由指向路由器
C
。
IP ROUTE 0.0.0.0 0.0.0.0 S0/0/1
在
C
路由器上设置到:
10.1.1.0/24
192.168.1.0/24
10.2.0.0/16
172.16.1.0/24
的静态路由。
——使用动态路由选择协议时,路由器之间便能够交换有关科大的网络信息和每个网络的状态。
——路由器发现多条到达某个网络的路径后,对他们的度量值进行比较,并选择度量值最小的路径。
——路由器将更新从指定的接口发送出去,并期望通过这些接口来接收更新。
——
ODR
依赖于
CDP
在中央路由器和分支路由器之间传输信息,因此在中央路由器和分支路由器上必须启用
CDP
。
——调整
CDP
更新定时器,使用全局命令:
CDP TIMER
——查看
CDP
设置:
SHOW CDP
——使用分类路由选择协议时,属于同一分类网络的所有接口必须使用相同的子网掩码。
——假设没有运行路由选择协议,而只是配置了静态路由,则使用默认路由无法到达已知主网络的子网,除非配置了命令:
IP CLASS
。
——命令
IP CLASS
告诉路由器,对于前往已知网络中未知子网或未知网络分组,应选择最佳的超网(
Super net
)或默认路由器来转发他们。
——
RIPv2
和
EIGRP
使用
NO AUTO-SUMMARY
来手动关闭路由汇总。
——
OSPF
和
IS-IS
默认情况下不进行自动汇总。
——运行无类路由选择协议的路由器在选择路由时使用最长前缀匹配,如果某台路由器在通告时没有进行汇总,其他路由器将同时看到子网和汇总路由。
——
RIPv2
使用组播地址
224.0.0.9
来将更新发送给
RIPv2
路由器;
RIPv1
使用广播地址
255.255.255.255
来发送更新,这使得所有设备(包括
PC
和服务器)都必须能够处理分组。
——
RIP
使用的端口是
520
。
——在接口上配置
RIP
版本
:ROUTER(CONFIG-IF)#IP RIP [SEND|RECEIVE] VERSION [1|2]
——从
12.3
开始
Cisco IOS
不再支持
IGRP
。
——静态路由全局配置命令:
IP ROUTE PREFIX MASK {ADDRESS | INTERFACE} [DISTANCE] [PERMANENT] [TAG]
——浮动路由就是修改静态路由
DISTANCE
的值。
ODR
路由配置:
——在路由器
B
上启用
ODR:ROUTER ODR
;
——在路由器
A
、
C
上启用
CDP
协议(接口或全局启用)。
配置完成后的路由表:
A
:
Router_A#sh ip route
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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 10.1.1.1 to network 0.0.0.0
172.16.0.0/24 is subnetted, 1 subnets
C
172.16.1.0 is directly connected, Loopback0
10.0.0.0/24 is subnetted, 1 subnets
C
10.1.1.0 is directly connected, Serial0/0
o*
0.0.0.0/0 [160/1] via 10.1.1.1, 00:00:47, Serial0/0
B
:
Router_B#sh ip route
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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
o
192.168.10.0/24 [160/1] via 192.168.1.1, 00:00:10, Serial0/1
172.16.0.0/24 is subnetted, 1 subnets
o
172.16.1.0 [160/1] via 10.1.1.2, 00:00:22, Serial0/0
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C
10.2.0.0/16 is directly connected, Loopback0
C
10.1.1.0/24 is directly connected, Serial0/0
C
192.168.1.0/24 is directly connected, Serial0/1
C:
Router_C#SH IP ROUTE
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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.1.2 to network 0.0.0.0
C
192.168.10.0/24 is directly connected, Loopback0
C
192.168.1.0/24 is directly connected, Serial0/0
o*
0.0.0.0/0 [160/1] via 192.168.1.2, 00:00:47, Serial0/0
在路由器
B
上用
SH IP PROTOCOL
观察
ODR
协议信息:
Router_B#SH IP PROTOCOL
Routing Protocol is "odr"
Sending updates every 60 seconds, next due in 0 seconds
Invalid after 180 seconds, hold down 0, flushed after 240
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Maximum path: 4
Routing Information Sources:
Gateway
Distance
Last Update
10.1.1.2
160
00:00:52
192.168.1.1
160
00:00:40
Distance: (default is 160)
静态路由
配置完成后的路由表:
A
:
Router_A#sh ip rout
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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 10.1.1.1 to network 0.0.0.0
172.16.0.0/24 is subnetted, 1 subnets
C
172.16.1.0 is directly connected, Loopback0
10.0.0.0/24 is subnetted, 1 subnets
C
10.1.1.0 is directly connected, Serial0/0
S*
0.0.0.0/0 [1/0] via 10.1.1.1
B:
Router_B#sh ip route
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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 0.0.0.0 to network 0.0.0.0
172.16.0.0/24 is subnetted, 1 subnets
S
172.16.1.0 is directly connected, Serial0/0
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C
10.2.0.0/16 is directly connected, Loopback0
C
10.1.1.0/24 is directly connected, Serial0/0
C
192.168.1.0/24 is directly connected, Serial0/1
S*
0.0.0.0/0 is directly connected, Serial0/1
C:
Router_C#sh ip route
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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.10.0/24 is directly connected, Loopback0
172.16.0.0/24 is subnetted, 1 subnets
S
172.16.1.0 [1/0] via 192.168.1.2
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
S
10.2.0.0/16 [1/0] via 192.168.1.2
S
10.1.1.0/24 [1/0] via 192.168.1.2
C
192.168.1.0/24 is directly connected, Serial0/0
RIP
配置
配置如下:
Router_A:
!
router rip
version 2
network 10.0.0.0
network 172.16.0.0
no auto-summary
!
Router_B:
!
interface Serial0/1
ip address 192.168.1.2 255.255.255.0
ip rip send version 1
ip rip receive version 1
serial restart-delay 0
!
!
router rip
version 2
network 10.0.0.0
network 192.168.1.0
!
Router_C:
!
router rip
network 192.168.1.0
network 192.168.10.0
!
Router_A#sh ip protocols
Routing Protocol is "rip"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Sending updates every 30 seconds, next due in 10 seconds
Invalid after 180 seconds, hold down 180, flushed after 240
Redistributing: rip
Default version control: send version 2, receive version 2
Interface Send Recv Triggered RIP Key-chain
Serial0/0
2
2
Loopback0 2 2
Automatic network summarization is not in effect
Address Summarization:
172.16.1.0/24 for Serial0/0
Maximum path: 4
Routing for Networks:
10.0.0.0
172.16.0.0
Routing Information Sources:
Gateway
Distance
Last Update
10.1.1.1
120
00:00:10
Distance: (default is 120)
Router_B#sh ip protocols
Routing Protocol is "rip"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Sending updates every 30 seconds, next due in 4 seconds
Invalid after 180 seconds, hold down 180, flushed after 240
Redistributing: rip
Default version control: send version 2, receive version 2
Interface
Send
Recv
Triggered RIP
Key-chain
Serial0/0
2
2
Serial0/1
1
1
Loopback0 2 2
Automatic network summarization is in effect
Maximum path: 4
Routing for Networks:
10.0.0.0
192.168.1.0
Routing Information Sources:
Gateway
Distance
Last Update
10.1.1.2
120
00:00:00
192.168.1.1
120
00:00:12
Distance: (default is 120)
Router_C#sh ip protocols
Routing Protocol is "rip"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Sending updates every 30 seconds, next due in 14 seconds
Invalid after 180 seconds, hold down 180, flushed after 240
Redistributing: rip
Default version control: send version 1,
receive any version
Interface
Send
Recv
Triggered RIP
Key-chain
Serial0/0
1
1 2
Loopback0 1 1 2
Automatic network summarization is in effect
Maximum path: 4
Routing for Networks:
192.168.1.0
192.168.10.0
Routing Information Sources:
Gateway
Distance
Last Update
192.168.1.2
120
00:00:04
Distance: (default is 120)
路由表信息:
Router_A#sh ip route
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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
R
192.168.10.0/24 [120/2] via 10.1.1.1, 00:00:11, Serial0/0
172.16.0.0/24 is subnetted, 1 subnets
C
172.16.1.0 is directly connected, Loopback0
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
R
10.2.0.0/16 [120/1] via 10.1.1.1, 00:00:11, Serial0/0
C
10.1.1.0/24 is directly connected, Serial0/0
R
192.168.1.0/24 [120/1] via 10.1.1.1, 00:00:11, Serial0/0
Router_B#SH IP ROUTE
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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
R
192.168.10.0/24 [120/1] via 192.168.1.1, 00:00:26, Serial0/1
172.16.0.0/24 is subnetted, 1 subnets
R
172.16.1.0 [120/1] via 10.1.1.2, 00:00:14, Serial0/0
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C
10.2.0.0/16 is directly connected, Loopback0
C
10.1.1.0/24 is directly connected, Serial0/0
C
192.168.1.0/24 is directly connected, Serial0/1
Router_C#SH IP ROUTE
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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.10.0/24 is directly connected, Loopback0
R
172.16.0.0/16 [120/2] via 192.168.1.2, 00:00:27, Serial0/0
R
10.0.0.0/8 [120/1] via 192.168.1.2, 00:00:27, Serial0/0
C
192.168.1.0/24 is directly connected, Serial0/0
本文转自 tiger506 51CTO博客,原文链接:http://blog.51cto.com/tiger506/98065,如需转载请自行联系原作者