OSPF E1 E2类型路由优选
- 格式:docx
- 大小:92.88 KB
- 文档页数:1


OSPF-3:OSPF对外部路由的选路规则完全验证版[实验目的]验证OSPF中对外部路由路由的选择规则OSPF在选择外部路由的时候,遵循的原则是:[1]O E1优于O E2[2]在同样的情况下,Cost越小越优先[3]在cost相同的情况下,选择到达ASBR最优的路径下面来通过实验来验证该规则:[案例1]当外部路由都是O E1的情况基本配置:(注意ASBR的配置)R1:interface Loopback0ip address 1.1.1.1 255.255.255.0ip ospf network point-to-point!interface Serial1/0ip address 12.1.1.1 255.255.255.0!interface Serial2/0ip address 13.1.1.1 255.255.255.0!router ospf 1redistribute rip subnets metric-type 1network 12.1.1.0 0.0.0.255 area 0!router ripversion 2network 13.0.0.0distance 109(因为RIP的AD大于OSPF,所以重发布到OSPF中,会发生路由抖动,故将其改小,详解看等级三实验手册1.3)no auto-summary!R2:interface Loopback0ip address 2.2.2.2 255.255.255.0ip ospf network point-to-point!interface Serial1/0ip address 24.1.1.2 255.255.255.0!interface Serial2/0ip address 12.1.1.2 255.255.255.0!router ospf 1network 12.1.1.0 0.0.0.255 area 0network 24.1.1.0 0.0.0.255 area 0!R3:interface Loopback0ip address 3.3.3.3 255.255.255.0ip ospf network point-to-point!interface Serial1/0ip address 13.1.1.3 255.255.255.0 !interface Serial2/0ip address 35.1.1.3 255.255.255.0 !router ripversion 2network 3.0.0.0network 13.0.0.0network 35.0.0.0no auto-summary!R4:interface Loopback0ip address 4.4.4.4 255.255.255.0ip ospf network point-to-point!interface Serial1/0ip address 45.1.1.4 255.255.255.0 !interface Serial2/0ip address 24.1.1.4 255.255.255.0 !router ospf 1network 24.1.1.0 0.0.0.255 area 0network 45.1.1.0 0.0.0.255 area 1!R5:interface Loopback0ip address 5.5.5.5 255.255.255.0ip ospf network point-to-point!interface Serial1/0ip address 35.1.1.5 255.255.255.0!interface Serial2/0ip address 45.1.1.5 255.255.255.0!router ospf 1redistribute rip subnets metric-type 1network 45.1.1.0 0.0.0.255 area 1!router ripversion 2network 35.0.0.0distance 109no auto-summary!监视和测试配置:查看R2的路由表:R2#sh ip rou35.0.0.0/24 is subnetted, 1 subnetsO E135.1.1.0 [110/84] via 12.1.1.1, 00:00:25, Serial2/02.0.0.0/24 is subnetted, 1 subnetsC2.2.2.0 is directly connected, Loopback03.0.0.0/24 is subnetted, 1 subnetsO E23.3.3.0 [110/84] via 12.1.1.1, 00:00:25, Serial2/024.0.0.0/24 is subnetted, 1 subnetsC24.1.1.0 is directly connected, Serial1/012.0.0.0/24 is subnetted, 1 subnetsC12.1.1.0 is directly connected, Serial2/013.0.0.0/24 is subnetted, 1 subnetsO E213.1.1.0 [110/84] via 12.1.1.1, 00:00:25, Serial2/0 45.0.0.0/24 is subnetted, 1 subnetsO IA45.1.1.0 [110/128] via 24.1.1.4, 00:00:26, Serial1/0查看R2的ospf数据库R1#sh ip os daType-5 AS External Link StatesLink ID ADV Router Age Seq# Checksum Tag3.3.3.0 1.1.1.1 237 0x80000001 0x00D93A 0 3.3.3.0 5.5.5.5 239 0x80000001 0x0061A2 0 13.1.1.0 1.1.1.1 509 0x80000001 0x008588 0 13.1.1.0 5.5.5.5 239 0x80000001 0x000DF0 0 35.1.1.0 1.1.1.1 238 0x80000001 0x006691 0 35.1.1.0 5.5.5.5 381 0x80000001 0x00EDF9 0可以看到R2从两个ASBR都收到了LSA 5的通告,但是R2选择了从R1走。
ospf:收集链路状态信息完全了解网络拓扑,使用spf算法自主的计算路径。
ospf特性:open 无类手动汇总层次化结构收敛快速触发更新等价负载均衡邻居表(邻接关系数据库):领居建立过程:init state:一方组播hello包two-way state:双方收到hello包形成邻居关系exstart state:交换bdb包选举dr/bdrexchange state:交换bdb包交换lsdb摘要。
loading state:交换lsufull state:完全邻接拓朴表(lsdb,链路状态数据库):同一区域内每个路由器的lsdb一致lsa:包含接口ip前缀、开销、优先级,包含于LSU中,遵循水平分割原则。
lsa序列号:lsa的生存周期为60分钟,30分钟定期刷新,没有被刷新lsa将会在60分钟后被丢弃ospf的五种包:hello、dbd、lsr、lsu、lsackdbd、lsr、lsu需lsack确认路由表区域:CISCO建议每个区域的路由器不应超过50台。
双层结构:中转区域:又称骨干区域或核心区域(area 0),用于流量的中转没有终端用户。
常规区域:连接终端用户用于数据的收发。
常规区域必须与骨干区域直连,常规区域间不能有直连链路。
常规区域包括标准区域、末节区域、绝对末节区域、次末节区域。
区域的设计:凭经验公司:核心层做area 0,汇聚和接入做常规区域整个ospf网络在同一个AS中ospf中的路由器指的是:接口骨干路由器:位于area 0abr:abr连接的区域数不应超过3个,abr也可以是asbrasbr:重分发配置ospf:r1(conftig)# router ospf 1r1(config)# network …………area 0(等同于ip ospf 1 area 0)验证OSPF:sh ip protocolssh ip router ospfsh ip ospf interfacesh ip ospfsh ip ospf neighbor detaildebug ip ospf eventsdebug ip ospf adjospf的网络类型(dead time=4*hello time)点到点(PPP、HDLC串口):直接邻接,hello-time 10s2、广播(LAN):选dr/bdr,hello-time 10sdrother与dr/bdr:邻接;drother之间:领居dr组播224.0.0.5;drother组播224.0.0.6dr的轮选:数值最大接口优先级(默认值1)ip ospf priority ?2、rid:环回地址、物理接口ip地址router-id ip address(次于优先级,ip地址可以为存在或不存在,不能指定其他路由器已有IP)dr稳定性,先到先得clear ip ospf process(清除ospf进程让dr重选;清除ospf进程邻居关系重新形成)3、ospf在nbma网络运行的公有模式:1、nbma:默认模式hello time 30s在hub-spoke拓朴,选dr/bdr,同一子网,中心路由器为dr/bdr边缘路由器(spoke)相互之间要做dlci的映射(dlci复用)中心路由器手动指定领居(如:nei 192.168.1.2 priority 0把spoke优先级设为0)2、p2m:hello time 30s同一子网,不选dr/bdr,多点fr子接口无需修改网络类型,邻接关系可以正常建立,但路由就没法学到,因此建议在多点fr子接口修改网络类型。
ip default-network、ip route、ip default-gateway的区别在cisco的16448文档中详细地讲解了这三条命令的使用条件和区别。
一、使用条件ip default-gateway在禁用了ip routing的情况下使用,该路由器被当做默认网关。
ip default-network和ip route 0.0.0.0 0.0.0.0 则可以在启用路由选择协议下使用。
二、区别ip default-network 与 ip route 0.0.0.0 0.0.0.0 的最大区别在于前者可以被路由选择协议宣告出去。
但是由于ip default-network这条命令是有类的,如果宣告的网络不是主类网,将不会被标记成*号。
ip default-network产生的默认路由是可以被EIGRP和RIP宣告的,但不被OSPF 宣告,至于OSPF怎么产生默认路由,上一边有介绍。
值得注意的是,RIP宣告ip default-network的路由条目是,使用0.0.0.0,可以debug ip rip看到。
ip route 0.0.0.0 0.0.0.0 也可以被EIRGP传播,但是这条静态路由必须重分发到EIGRP协议中;在12.0T以后的IOS版本中,RIP将不宣告默认路由,除非是通过RIP学习到得,或者重分发到RIP中。
同样,在OSPF中也不能传播该命令产生的默认路由,(default-information originate命令)三、负载均衡如果用ip default-network配置了去往同一目的的多条默认路由,路由表会选择管理距离最小,如果管理距离都一样则选择最先配置的那条。
同时使用ip default-network和ip route 0.0.0.0 0.0.0.0双方设定默认路由时,如果ip default-network设定的网络是直连(静态、且已知)的,那么它就成为默认路由;如果ip default-network指定的网络是由交换路由信息得来的,则ip route 0.0.0.0 0.0.0.0指定的表项成为默认路由。