本文共 4620 字,大约阅读时间需要 15 分钟。
动态路由:
是指路由器能够自动地建立自己的路由表,并且能够根据实际情况的变化适时地进行调整。
原理:
动态路由机制的运作依赖路由器的两个基本功能:路由器之间适时的路由信息交换,对路由表的维护:
路由器之间适时地交换路由信息。
动态路由之所以能根据网络的情况自动计算路由、选择转发路径,是由于当网络发生变化时,路由器之间彼此交换的路由信息会告知对方网络的这种变化,通过信息扩散使所有路由器都能得知网络变化。路由器根据某种路由算法(不同的动态路由协议算法不同)把收集到的路由信息加工成路由表,供路由器在转发IP报文时查阅。在网络发生变化时,收集到最新的路由信息后,路由算法重新计算,从而可以得到最新的路由表。协议RIP:
路由信息协议(RIP) 是内部网关协议IGP中最先得到广泛使用的协议。RIP是一种分布式的基于距离向量的路由选择协议,是因特网的标准协议,其最大优点就是实现简单,开销较小。
OSPF:
OSPF(Open Shortest Path First开放式最短路径优先)是一个内部网关协议(Interior Gateway Protocol,简称IGP),用于在单一自治系统(autonomous system,AS)内决策路由。
IS-IS:
IS-IS(Intermediate System-to-Intermediate System,中间系统到中间系统)路由协议最初是ISO(the International Organization for Standardization,国际标准化组织)为CLNP(Connection Less Network Protocol,无连接网络协议)设计的一种动态路由协议。
BGP:
边界网关协议(BGP)是运行于 TCP 上的一种自治系统的路由协议。 BGP 是唯一一个用来处理像因特网大小的网络的协议,也是唯一能够妥善处理好不相关路由域间的多路连接的协议。
特点1、无需管理员手工维护,减轻了管理员的工作负担。
2、占用了网络带宽。
3、在路由器上运行路由协议,使路由器可以自动根据网络拓朴结构的变化调整路由条目;
4、网络规模大、拓扑复杂的网络
配置实验:
实验拓扑图
配置过程:
R1#conf tR1(config)#int f0/0R1(config-if)#ip add 192.168.20.2 255.255.255.0R1(config-if)#no shut //f0/0接口配置IP地址并且开启R1(config-if)#int f0/1R1(config-if)#ip add 192.168.30.1 255.255.255.0R1(config-if)#no shut //f0/1接口配置IP地址并且开启R1(config)#ip route 192.168.10.0 255.255.255.0 192.168.20.1 //配置到192.168.10.0网段的静态路由R1(config)#router ospf 1 //开启ospf协议R1(config-router)#network 192.168.30.0 255.255.255.0 area 1 //在area 1 宣告192.168.30.0网段R1(config-router)#redistribute static subnets //重分发静态路由R1(config-router)#redistribute connected subnets //重分发直连网段
R2#conf tR2(config)#int f0/0R2(config-if)#ip add 192.168.10.1 255.255.255.0R2(config-if)#no shut //f0/0接口配置IP并且开启R2(config)#int f0/1R2(config-if)#ip add 192.168.20.1 255.255.255.0R2(config-if)#no shut //f0/1接口配置IP并且开启R2(config)#ip route 0.0.0.0 0.0.0.0 192.168.20.2 //配置默认路由
R3#conf tR3(config)#int f0/0R3(config-if)#ip add 192.168.30.2 255.255.255.0R3(config-if)#no shut //f0/0接口配置IP并且开启R3(config)#int f0/1R3(config-if)#ip add 192.168.40.1 255.255.255.0R3(config-if)#no shut //f0/1接口配置IP并且开启R3(config)#int f1/1R3(config-if)#no switchport //开启路由功能R3(config-if)#ip add 12.0.0.1 255.255.255.0 R3(config-if)#no shut //f1/1接口配置IP并且开启R3(config)#int f1/0R3(config-if)#no switchportR3(config-if)#ip add 192.168.70.1 255.255.255.0 R3(config-if)#no shut //f1/0接口配置IP并且开启R3(config)#router ospf 1 //开启ospf协议R3(config-router)#network 192.168.30.0 255.255.255.0 area 1 //在area 1 宣告192.168.30.0网络R3(config-router)#network 192.168.40.0 255.255.255.0 area 0 //在area 0 宣告192.168.40.0网络R3(config-router)#network 192.168.70.0 255.255.255.0 area 0 //在area 0 宣告192.168.70.0网络R3(config-router)#ex R3(config)#ip route 0.0.0.0 0.0.0.0 12.0.0.2 //配置默认路由R3(config)#router ospf 1R3(config-router)#default-information originate //重分发默认路由
R4#conf tR4(config)#int f0/0R4(config-if)#ip add 192.168.40.2 255.255.255.0R4(config-if)#no shut //f0/0接口配置IP并且开启R4(config)#int f0/1R4(config-if)#ip add 192.168.50.1 255.255.255.0R4(config-if)#no shut //f0/1接口配置IP并且开启R4(config)#router ospf 1 //开启ospf协议R4(config-router)#network 192.168.40.0 255.255.255.0 area 0 //在area 0 宣告192.168.40.0网段R4(config)#router rip //开启rip协议R4(config-router)#version 2 //选择版本2R4(config-router)#network 192.168.50.0 //宣告192.168.50.0网段R4(config-router)#no auto-summary //关闭路由汇总R4(config-router)#exR4(config)#router ospf 1 R4(config-router)#redistribute rip subnets //在ospf协议中重分发RIPR4(config)#router ripR4(config-router)#redistribute ospf 1 metric 3 //在RIP协议中重分发ospf,跳数为3 (这里3-5最合适)R4(config-router)#ex
ISP#conf tISP(config)#int f0/0ISP(config-if)#ip add 12.0.0.2 255.255.255.0ISP(config-if)#no shut //f0/0配置IP并且开启ISP(config-if)#exISP(config)#int f0/1ISP(config-if)#ip add 13.0.0.1 255.255.255.0ISP(config-if)#no shut //f0/1配置IP并且开启 ISP(config-if)#exISP(config)#ip route 0.0.0.0 0.0.0.0 12.0.0.1 //配置默认路由
R6#conf tR6(config)#int f0/0R6(config-if)#ip add 192.168.50.2 255.255.255.0R6(config-if)#no shut //f0/0接口配置IP并且开启R6(config-if)#exR6(config)#int f0/1R6(config-if)#ip add 192.168.60.1 255.255.255.0R6(config-if)#no shut //f0/1接口配置IP并且开启R6(config-if)#ex R6(config)#router rip //开启RIP协议R6(config-router)#version 2 //选择版本2R6(config-router)#network 192.168.50.0 //在RIP协议中宣告192.168.50.0网段R6(config-router)#network 192.168.60.0 //宣告192.168.60.0网段R6(config-router)#no auto-summary //关闭路由汇总R6(config-router)#ex配置完毕后我们逐个查看路由器的路由表
R1路由器的路由表
R2路由器的路由表
R3路由器的路由表
R4路由器的路由表
R5(ISP)路由器的路由表
R6路由器的路由表
接下来我们使用vpcs配置四台pc机的IP进行全网互通的验证
转载于:https://blog.51cto.com/13687553/2161712