网络构建二路由部分3、IP网络间路由选择课程的目的配置静态路由默认路由动态路由:距离向量路由环路及其消除方法有类路由协议和无类路由协议配置RIPV1和RIPV2议题172.16.1.010.1.1.0非直连的IP网络信息源目的网络直连学习获得10.1.1.0172.16.1.0转发接口E0S0172.16.1.010.1.1.0E0S0路由信息路由信息源,可到达路径,最佳路径Routershowiproute显示路由表的信息R172.16.8.0/24[120/8]via172.16.7.9,00:00:23,Serial0R--路由信息源(RIP)172.16.8.0/24--目的子网/子网掩码[120--管理代价/8]--度量值via172.16.7.9--转发路由器的IP地址00:00:23--该记录已存活的时间(递增值)Serial0--本地接口路由条目1.静态路由2.动态路由获得路由信息源router(config)#iproute[网络编号][子网掩码][转发路由器的IP地址/本地接口]配置静态路由router(config)#iproute172.16.1.0255.255.255.0172.16.2.1或router(config)#iproute172.16.1.0255.255.255.0serial0172.16.2.1S0172.16.1.0B172.16.2.2网络AB10.0.0.0静态路由配置实例172.16.2.1SO172.16.1.0B172.16.2.2网络AB10.0.0.0router(config)#iproute0.0.0.00.0.0.0172.16.2.2默认路由172.16.2.1SO172.16.1.0B172.16.2.2网络AB172.16.3.0router(config)#iproute0.0.0.00.0.0.0172.16.2.2router(config)#ipclassless访问相同主类未知子网类型一:距离向量工作特点:定期向邻居路由器发送路由表的副本并且计算距离向量距离:度量值向量:方向RIP(路由信息协议)RIPV1发送地址:255.255.255.255(本地广播)RIPV2发送地址:224.0.0.9(所有的RIPV2路由器)RIP使用UDP协议520端口发送路由信息动态路由协议ABC10.1.0.010.2.0.010.3.0.010.4.0.0E0S0S0S1S0E010.3.0.0S0E0S0S01210.1.0.010.2.0.010.4.0.00010.1.0.0E0S0S0S01210.4.0.010.3.0.010.2.0.00010.2.0.0S0S1S1S01110.1.0.010.4.0.010.3.0.000距离向量B-F算法AB更新路由表网络拓扑结构发生改变等待下一个发送周期通告更新后全部的路由表以时间驱动更新路由表ABC10.1.0.010.2.0.010.3.0.010.4.0.0E0S0S0S1S0E0X10.3.0.0S0E0S0S01210.1.0.010.2.0.010.4.0.00Down10.1.0.0E0S0S0S01210.4.0.010.3.0.010.2.0.00010.2.0.0S0S1S1S01110.1.0.010.4.0.010.3.0.000路由环路ABC10.1.0.010.2.0.010.3.0.010.4.0.0E0S0S0S1S0E0X10.3.0.0S0S0S0S01210.1.0.010.2.0.010.4.0.00210.1.0.0E0S0S0S01210.4.0.010.3.0.010.2.0.00010.2.0.0S0S1S1S11110.1.0.010.4.0.010.3.0.000路由环路ABC10.1.0.010.2.0.010.3.0.010.4.0.0E0S0S0S1S0E0XS0S0S0S01210.3.0.010.1.0.010.2.0.010.4.0.002E0S0S0S01410.1.0.010.4.0.010.3.0.010.2.0.000S0S1S1S03110.2.0.010.1.0.010.4.0.010.3.0.000路由环路ABC10.1.0.010.2.0.010.3.0.010.4.0.0E0S0S0S1S0E0X10.3.0.0S0S0S0S01210.1.0.010.2.0.010.4.0.004E0S0S0S01610.1.0.010.4.0.010.3.0.010.2.0.000S0S1S1S05110.2.0.010.1.0.010.4.0.010.3.0.000度量值趋向于无穷大ABC10.1.0.010.2.0.010.3.0.010.4.0.0E0S0S0S1S0E0X10.3.0.0S0S0S0S01210.1.0.010.2.0.010.4.0.0016E0S0S0S011610.1.0.010.4.0.010.3.0.010.2.0.000S0S1S1S016110.2.0.010.1.0.010.4.0.010.3.0.000RIP定义最大值为15ABC10.1.0.010.2.0.010.3.0.010.4.0.0E0S0S0S1S0E0XXX10.3.0.0S0S0S0S01210.1.0.010.2.0.010.4.0.000E0S0S0S01210.1.0.010.4.0.010.3.0.010.2.0.000S0S1S1E11210.2.0.010.1.0.010.4.0.010.3.0.000解决路由环路的方法:水平分割ABC10.1.0.010.2.0.010.3.0.010.4.0.0E0S0S0S1S0E0X10.3.0.0S0S0S0S01210.1.0.010.2.0.010.4.0.001610.1.0.0E0S0S0S01210.4.0.010.3.0.010.2.0.00010.2.0.0S0S1S1E11210.1.0.010.4.0.010.3.0.000解决收敛问题:路由毒化Subnet10.4.0.0metric16ABC10.1.0.010.2.0.010.3.0.010.4.0.0E0S0S0S1S0E0X10.3.0.0S0S0S0S01210.1.0.010.2.0.010.4.0.001610.1.0.0E0S0S0S01210.4.0.010.3.0.010.2.0.00010.2.0.0S0S1S1E1PossiblyDown210.1.0.010.4.0.010.3.0.000确认收敛:逆向毒化Subnet10.4.0.0metric16ABC10.1.0.010.2.0.010.3.0.010.4.0.0E0S0S0S1S0E0X等待网络中其它路由器收敛,在该时间内不学习任何与该网络相关的路由信息(RIP缺省180秒),在倒记时其间继续向其它路由器发送毒化信息Hold-down倒记时hold-down倒记时以后更新路由表hold-down倒记时以后更新路由表ABC10.2.0.010.3.0.010.4.0.0E0S0S0S1S0E0Xsubnet10.4.0.0,metric1610.1.0.0subnet10.4.0.0,metric16subnet10.4.0.0,metric16得知网络拓扑结构发生改变,不等待发送周期,立刻通告更新后全部的路由表触发更新1.启用RIP进程router(config)#routerriprouter(config-router)#2.配置network命令router(config-router)#network主类网络号含义:1.公布属于该主类的子网2.包含在该主类内的接口发送接收路由信息3.配置均衡负载(代价相等)router(config-router)#maximum-paths1-6缺省为“4”4.配置RIP发布初始度量值router(config-router)#default-metric1-4294967295缺省为“5”建议设置为“1”配置RIP验证RIP的配置router#showipprotocols显示路由表的信息router#showiproute清除IP路由表的信息router#cleariproute*在控制台显示RIP的工作状态router#debugipripRIP的调试1.路由信息在主类边界自动按主类汇总10.1.0.0172.16.2.010.2.0.010.1.0.010.2.0.0172.16.0.010.0.0.0172.16.1.0172.16.2.010.1.0.010.2.0.0172.16.1.0172.16.2.0172.16.1.0有类路由协议的工作特点172.16.5.0255.255.255.0192.168.14.16255.255.255.240172.16.6.0255.255.255.0ABCNetwork172.16.0.0Network172.16.0.0不支持不连续的子网有类路由协议的工作特点2.路由信息中不含子网掩码(相同主类子网掩码长度必须一致)192.168.5.129/27192.168.5.98/27192.168.5.33/27192.168.5.65/27192.168.5.97/27S1S0E1E0E0有类路由协议的工作特点1.手工控制路由汇总10.1.0.0172.16.2.010.2.0.010.1.0.010.2.0.0172.16.2.0172.16.1.010.1.0.010.2.0.0172.16.1.0172.16.2.010.1.0.010.2.0.0172.16.1.0172.16.2.0172.16.1.0无类路由协议的工作特点172.16.5.0255.255.255.0192.168.14.16255.255.255.240172.16.6.0255.255.255.0ABCNetwork172.16.5.0Network172.16.6.0支持不连续的子网无类路由协议的工作特点192.168.5.129/27192.168.5.209/30192.168.5.33/27192.168.5.65/27192.168.5.210/30S1S0E1E0E02.路由信息中含子网掩码(相同主类支持VLSM)无类路由协议的工作特点1.启用RIPV2进程router(config)#routerriprouter(config-router)#version22.在主类边界关闭自动汇总router(config-router)#noauto-summary配置RIPV264KE1E1BA跳数RIPOSPF带宽管理代价直连0静态路由(接口)0静态路由(IP地址)1EBGP20OSPF110IS-IS115RIPv1/v2120EGP140IBGP200Unknown255(不出现在路由表当中)管理代价(0-255):标识路由信息源的可信度管理代价192.168.5.33/32主机192.168.5.32/27子网192.168.5.0/24主类网络192.168.0.0/16超网0.0.0.0/0默认路由器选择路由条目使用(考虑的优先度高于管理代价)子网掩码最长匹配原则课程回顾配置静态路由默认路由动态路由:距离向量路由环路及其消除方法有类路由协议和无类路由协议配置RIPV1和RIPV2