LSA(链路状态通告)类型
LSA Type |
Description |
1 |
Router LSAs: |
2 |
Network LSAs |
3&4 |
Summary LSAs |
5 |
Autonomous system external LSAs |
6 |
Multicast OSPF LSA |
7 |
Defined for not-so-stubby areas |
8 |
External attributes LSA for Border Gateway Protocol (BGP) |
9, 10, 11 |
Opaque LSAs |
1、router LSAs(一类)
路由器LSA:没一台路由器都会产生路由器LSA。这个最基本的LSA通告列出了路由器所有的链路或接口,并且指明了他们的状态和沿每条链路方向出站的开销,以及该链路上的所有OSPF邻居
以上拓扑所示的两台路由器都已经配置好。
使用R1#show ip ospf database router得到下面的信息
OSPF Router with ID (1.1.1.1) (Process ID 1)
Router Link States (Area 0)
LS age: 176
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 1.1.1.1 注:使用的是router-ID
Advertising Router: 1.1.1.1
LS Seq Number: 80000004
Checksum: 0x65F9
Length: 60
Number of Links: 3
Link connected to: a Stub Network
(Link ID) Network/subnet number: 1.1.1.1
(Link Data) Network Mask: 255.255.255.255 【这个是由他的网络类型决定的,默认是LOOPBACK,修改为点对点之后就会不一样了(Link ID) Network/subnet number: 1.1.1.0
(Link Data) Network Mask: 255.255.255.0】
Number of TOS metrics: 0
TOS 0 Metrics: 1 【开销,出接口】
Link connected to: another Router (point-to-point)
(Link ID) Neighboring Router ID: 2.2.2.2
(Link Data) Router Interface address: 12.1.1.1
Number of TOS metrics: 0
TOS 0 Metrics: 64
Link connected to: a Stub Network
(Link ID) Network/subnet number: 12.1.1.0
(Link Data) Network Mask: 255.255.255.0
Number of TOS metrics: 0
TOS 0 Metrics: 64
综上所得:R2学到R1还回口的开销等于:64+1=65
R2#show ip route ospf
1.0.0.0/24 is subnetted, 1 subnets
O 1.1.1.0 [110/65] via 12.1.1.1, 00:03:07, Serial1/0
2、network LSA(二类)
网络LSA,每一个多路访问的网络中的指定路由器(DR)将会产生网络LSA。
R4#show ip ospf database network
OSPF Router with ID (4.4.4.4) (Process ID 1)
Net Link States (Area 2)
Routing Bit Set on this LSA
LS age: 256
Options: (No TOS-capability, DC)
LS Type: Network Links
Link State ID: 34.1.1.1 (address of Designated Router) 指定路由器与邻居相连的接口IP。
Advertising Router: 3.3.3.3
LS Seq Number: 80000001
Checksum: 0x9755
Length: 32
Network Mask: /24 说明一下的地址的子网掩码都是24位
Attached Router: 3.3.3.3 都是Router ID
Attached Router: 4.4.4.4
3、summary LSA (三类)
自治系统内汇总的LSA,由ABR路由器发出的LSA。ABR路由器将发送网络汇总LSA到一个区域,用来通告该区域外部的目的地址。
在R2上做区域汇总:R2(config-router)#area 0 range 1.1.0.0 255.255.252.0
在R3查看路由表和链路状态数据库
R3#show ip route ospf
1.0.0.0/22 is subnetted, 1 subnets
O IA 1.1.0.0 [110/129] via 23.1.1.1, 00:03:33, Serial1/0
12.0.0.0/24 is subnetted, 1 subnets
O IA 12.1.1.0 [110/128] via 23.1.1.1, 00:03:33, Serial1/0
R3#show ip ospf database summary
OSPF Router with ID (3.3.3.3) (Process ID 1)
Summary Net Link States (Area 1)
Routing Bit Set on this LSA
LS age: 240
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 1.1.0.0 (summary Network Number) //汇总的网络号
Advertising Router: 23.1.1.1
LS Seq Number: 80000001
Checksum: 0x9D9
Length: 28
Network Mask: /22 //汇总后的子网掩码
TOS: 0 Metric: 65
Routing Bit Set on this LSA
LS age: 240
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 12.1.1.0 (summary Network Number) //汇总的网络号
Advertising Router: 23.1.1.1
LS Seq Number: 80000001
Checksum: 0x7361
Length: 28
Network Mask: /24 //汇总后的子网掩码,这里没有进行汇总,所以不变
TOS: 0 Metric: 64
R3学到R1环回口IP地址所需要的开销计算:
要到达1.1.0.0网段首先要到23.1.1.1即R2使用一类LSA可以达到。
其次是使用汇总LSA,两者相加就可以得到了
R3#show ip ospf database route
OSPF Router with ID (3.3.3.3) (Process ID 1)
Router Link States (Area 1)
Link connected to: another Router (point-to-point)
(Link ID) Neighboring Router ID: 23.1.1.1
(Link Data) Router Interface address: 23.1.1.2
Number of TOS metrics: 0
TOS 0 Metrics: 64
R3# show ip ospf database summary
Link State ID: 1.1.0.0 (summary Network Number)
Advertising Router: 23.1.1.1
LS Seq Number: 80000001
Checksum: 0x9D9
Length: 28
Network Mask: /22
TOS: 0 Metric: 65
64+65=129