本帖最后由 子杰 于 2013-3-28 21:58 编辑
LSA的知识
1.1 什么是LSA链路状态路由通告,包括链路和状态; 链路包括接口IP地址/子网掩码/网络号/哪些接口运行OSPF; 状态是指和谁是邻居或邻接关系等; 注意:LSA不是包,它是LSU包里的一个内容,LSU是更新包,含有多条LSA。 1.2 如何区分LSA通过序列号来区分LSA,序列号是 32 位长,以0x80000001 开头,0x7FFFFFFF 结尾.OSPF 路由器默认每 30 分钟洪泛一次 LSA 来保证 LSDB 的同步,每洪泛 1 次,序列号就加1。 1.3 如何接收LSA
上图所示: l 如果收到的LSA与自己的不同,则加进database,发送回应LSAck包,将收到的LSAck泛洪出去,再以自己为根计算出最优路径,加入到路由表中。 l 如果收到的LSA与自己相同,接着查看lsa的序列号,如果不同,则比较是比自己大还是小序列号比自己大的就将其LSA加入database中,再按上面的步骤最终放入路由表,序列号比自己小,就将其LSA丢弃,则把自己的LSA发给它。 l 如果收到的序列号是相同的,则直接丢弃该LSA。 1.4 如何确认LSA的种类通过LSR中的三个字段来确认是哪种LSA,分别是link-id/LSA type/公告router-id; 1.5 LSA的种类l RouterLSA(1类LSA) R1#show ip ospfdatabase router 1.1.1.1 /查看R1的1类LSA/ OSPF Router with ID (1.1.1.1) (Process ID 1) Router Link States (Area 0) LSage: 217 Options: (No TOS-capability, DC) LSType: Router Links /LSA的类型为RouterLSA/ LinkState ID: 1.1.1.1 /1.1.1.1表示为为R1的Router-ID/ Advertising Router: 1.1.1.1 /表示 1类LSA是由自己设备产生/ LS SeqNumber: 80000003 Checksum: 0xC5B5 Length: 48 Numberof Links: 2 /区域内所连接的链路有2条/ Linkconnected to: a Transit Network /链路类型为transit network/ (Link ID) Designated Router address: 13.13.13.3/该链路的DR是R3/ (Link Data) Router Interface address: 13.13.13.1/该链路中R1的接口地址/ Number of TOS metrics: 0 TOS 0 Metrics: 1 Link connected to: a Transit Network (Link ID) Designated Router address: 12.12.12.2 (Link Data) Router Interface address: 12.12.12.1 Number of TOS metrics: 0 TOS 0 Metrics: 1 作用:只能在本区域传递,不能传出ABR; 特点:1类LSA的link-ID是路由器的Router-ID,且公告路由器是自己本身;
l NetworkLSA(2类LSA) R1#show ip ospfdatabase network /查看R1的2类LSA/ OSPF Router with ID (1.1.1.1) (Process ID 1) Net Link States (Area 0) Routing Bit Set on this LSA LSage: 1341 Options: (No TOS-capability, DC) LSType: Network Links /该LSA类型为2类LSA/ LinkState ID: 12.12.12.2 (address of Designated Router)/表示的该链路的DR地址/ Advertising Router: 2.2.2.2 /表示该2类LSA是由DR设备接口产生的/ LS SeqNumber: 80000001 Checksum: 0x14EB Length: 32 Network Mask: /24 /该网段的前缀为24/ Attached Router: 2.2.2.2 /与R2路由器相连/ Attached Router: 1.1.1.1 /与R1路由器相连/ Routing Bit Set on this LSA LSage: 1277 Options: (No TOS-capability, DC) LSType: Network Links LinkState ID: 13.13.13.3 (address of Designated Router) Advertising Router: 3.3.3.3 LS SeqNumber: 80000001 Checksum: 0xE90A Length: 32 Network Mask: /24 Attached Router: 3.3.3.3 Attached Router: 1.1.1.1 作用:2类的LSA只能在本区域内传递; 特点:2类LSA由DR产生的LSA,link-ID是DR地址;
file:///C:/Users/ADMINI~1/AppData/Local/Temp/msohtmlclip1/01/clip_image001.gif
1类和2类的LSA结合得出设备本区域内设备互连接口地址 通过1类的LSA,得出设备接口互联地址,如下 Linkconnected to: a Transit Network /链路类型为transit network/ (Link ID) Designated Router address: 13.13.13.3/该链路的DR是R3/ (Link Data) Router Interface address: 13.13.13.1/该链路中R1的接口地址/ Number of TOS metrics: 0 TOS 0 Metrics: 1 /该链路网段的cost值为1/ 通过2类的LSA,得出设备接口互联网段的掩码,如下 NetworkMask: /24 /与R3互联网段的掩码为255.255.255.0/ Attached Router: 3.3.3.3 以上可以得出R1与R3互连网段为13.13.13.0/24
l SummaryLSA(3类LSA) R1#show ip ospfdatabase summary /查看R1收到的3类LSA/ OSPF Router with ID (1.1.1.1) (Process ID 1) SummaryNet Link States (Area 0) Routing Bit Set on this LSA LSage: 849 Options: (No TOS-capability, DC, Upward) LSType: Summary Links(Network) /LSA为3类的LSA/ LinkState ID: 24.24.24.0 (summary Network Number)/该link-ID值是汇总网络号/ Advertising Router: 2.2.2.2 /表示3类LSA是由R2汇总出来的,该路由为ABR / LS SeqNumber: 80000002 Checksum: 0xF1F8 Length: 28 Network Mask: /24 /该网络的掩码为255.255.255.0/ TOS: 0 Metric: 1 /该链路的cost值为1/ Routing Bit Set on this LSA LSage: 1029 Options: (No TOS-capability, DC, Upward) LSType: Summary Links(Network) LinkState ID: 35.35.35.0 (summary Network Number) Advertising Router: 3.3.3.3 LS SeqNumber: 80000002 Checksum: 0x467F Length: 28 Network Mask: /24 TOS: 0 Metric: 1 作用:将一个区域内的路由汇总后传递给另一个区域; 特点:3类LSA是由ABR产生的,此时link-ID不是router-ID,也不是DR地址,是汇总的网络号;3类LSA能得出R2和R4互连的网段为24.24.24.0/24;3类的LSA公告路由器会改变,每经过一个ABR会改变为所正经过ABR的RID地址;
l ASBR Summary LSA(4类LSA) R1#show ip ospfdatabase asbr-summary /该R1的4类LSA/ OSPF Router with ID (1.1.1.1) (Process ID 1) Summary ASB Link States (Area 0) Routing Bit Set on this LSA LSage: 1 Options: (No TOS-capability, DC, Upward) LSType: Summary Links(AS Boundary Router) /该LSA的类型为4类LSA/ LinkState ID: 4.4.4.4 (AS Boundary Router address)/该link-ID是ASBR的RID地址 Advertising Router: 2.2.2.2 /该4类的LSA是由R2通告出来的/ LS SeqNumber: 80000001 Checksum: 0x9092 Length: 28 Network Mask: /0 TOS: 0 Metric: 1 作用:用于告诉其他路由器哪台设备是ASBR, 特点:4类LSA是由与ASBR同一个区域的ABR产生,通过ABR能传递到其他的区域; 4类的LSA公告路由器不会改变,一直都是ASBR同一个区域ABR的RID地址
l External LSA(5类LSA) R1#show ip ospfdatabase external /查看5类的LSA/ OSPF Router with ID (1.1.1.1) (Process ID 1) Type-5 AS External Link States Routing Bit Set on this LSA LSage: 98 Options: (No TOS-capability, DC) LSType: AS External Link /表示5类LSA/ LinkState ID: 44.4.4.0 (External Network Number ) /表示link-ID是外部网络号/ Advertising Router: 4.4.4.4 /表示5类LSA是由ASBR产生的/ LS SeqNumber: 80000002 Checksum: 0xD288 Length: 36 Network Mask: /24 /外部网络号的掩码,为255.255.255.0/ Metric Type: 2 (Larger than any linkstate path) /表示五类LSA的类型为E2/ TOS: 0 Metric: 20 /E2的默认cost值是20/ Forward Address: 0.0.0.0 /0.0.0.0表示去往外部路由需通过该路由器出去/ External Route Tag: 0 作用:将OSPF的域外路由通告给其他的区域,5类LSA的是由ASBR产生; 特点:5类的LSA公告路由器不会改变,一直都是ASBR的本身RID地址;
l Nssa-external LSA(7类LSA) R3#show ip ospfdatabase nssa-external /用于查看7类LSA/ OSPF Router with ID (3.3.3.3) (Process ID 1) Type-7 AS External Link States (Area 2) Routing Bit Set on this LSA LSage: 54 Options: (No TOS-capability, Type 7/5translation, DC) LSType: AS External Link /7类LSA/ LinkState ID: 5.5.5.0 (External Network Number )/该link-ID表示的是外部路由网络号/ Advertising Router: 5.5.5.5 /7类LSA是由NSSA区域里的ASBR通告出来的/ LS SeqNumber: 80000001 Checksum: 0x3FC5 Length: 36 Network Mask: /24 /外部路由网段的掩码为255.255.255.0/ Metric Type: 2 (Larger than any link state path) TOS: 0 Metric: 20 Forward Address: 35.35.35.5 External Route Tag: 0 作用:将7类的LSA通过NSSA同个区域内的ABR转化,转化成5类的LSA,再传递给其他的区域;
-----------------------------------------------------------------------------------------
SPOTO 我们共创未来
您的朋友 周俊杰(Jay)
Email:zhoujj@spoto.net
新浪微博:http://weibo.com/zhoujj0130
新浪博客:http://blog.sina.com.cn/zhoujj0130
-----------------------------------------------------------------------------------------
|