OSPF

OSPF LSA Types

Welcome to my tutorial about OSPF link state advertisment types.

I am sorry for the long article, but it’s inevitable when describing all those types in 1 article.

If you are new in networking, don’t get deep on the details and just understand the basics you need.

Abstract : 

  • Type 1 : created by each router to describe their directly connected networks.
  • Type 2 : created by the DR and contain the RID of the routers on the same segment along with the network mask.
  • Type 3 : created by the ABR and contain summary routes for networks in an area. and they are injected in other areas.
  • Type 4 : created by the ABR to areas that is not directly connected to the ASBR. and contain information to reach the ASBR.
  • Type 5 : created by the ASBR when external routes (non-ospf routes) are injected into OSPF.
  • Type 7 : created only by the ASBR that connect NSSA to non-ospf routes.

Now let’s talk about them in detail but before i do i have added some routers to the diagram.

Please don’t worry from amount of networks, we are not going to use most of them.

I will include that topology at the end so you can train on it yourself.

ospf-example

 

The next 2 commands output’s are the Big overview which i am going to explain. 

Reference 1 (from R3 point of view) . 

R3#show ip ospf database

            OSPF Router with ID (3.3.3.3) (Process ID 1)

                Router Link States (Area 1) (Type 1)
Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         1637        0x80000005 0x0011F5 1
2.2.2.2         2.2.2.2         1639        0x80000005 0x00D22B 1
3.3.3.3         3.3.3.3         1631        0x80000006 0x00FCAE 2
4.4.4.4         4.4.4.4         1567        0x80000006 0x00D50C 3
5.5.5.5         5.5.5.5         1622        0x80000004 0x001C0B 2

                Net Link States (Area 1) (type 2)
Link ID         ADV Router      Age         Seq#       Checksum
10.0.0.2        2.2.2.2         1639        0x80000003 0x000EF9
20.0.0.4        4.4.4.4         1567        0x80000003 0x0015DE

                Summary Net Link States (Area 1) (type 3)
Link ID         ADV Router      Age         Seq#       Checksum
40.0.0.0        5.5.5.5         1622        0x80000004 0x0047AC
50.0.0.0        5.5.5.5         1169        0x80000001 0x002FB3
60.0.0.0        5.5.5.5         1129        0x80000002 0x00B422
70.0.0.0        5.5.5.5         1170        0x80000001 0x004850
80.0.0.0        5.5.5.5         1130        0x80000002 0x0014A4
90.0.0.0        5.5.5.5         1170        0x80000001 0x00CAF8
100.0.0.0       5.5.5.5         1130        0x80000002 0x00AA04
110.0.0.0       5.5.5.5         1130        0x80000001 0x009802

                Summary ASB Link States (Area 1) (type 4)
Link ID         ADV Router      Age         Seq#       Checksum
7.7.7.7         5.5.5.5         1130        0x80000002 0x00688E
10.10.10.10     5.5.5.5         1130        0x80000001 0x004E92

                Type-5 AS External Link States (type 5)
Link ID         ADV Router      Age         Seq#       Checksum Tag
199.0.0.0       7.7.7.7         1188        0x80000001 0x00FBF8 199
200.0.0.0       10.10.10.10     20          0x80000002 0x00FD6E 200

Reference 2 (from R3 point of view)

  50.0.0.0/24 is subnetted, 1 subnets
O IA    50.0.0.0 [110/94] via 20.0.0.4, 00:03:36, FastEthernet0/1
     100.0.0.0/24 is subnetted, 1 subnets
O IA    100.0.0.0 [110/95] via 20.0.0.4, 00:03:36, FastEthernet0/1
     70.0.0.0/24 is subnetted, 1 subnets
O IA    70.0.0.0 [110/148] via 20.0.0.4, 00:03:36, FastEthernet0/1
O E2 200.0.0.0/24 [110/20] via 20.0.0.4, 00:03:36, FastEthernet0/1
     80.0.0.0/24 is subnetted, 1 subnets
O IA    80.0.0.0 [110/105] via 20.0.0.4, 00:03:36, FastEthernet0/1
     20.0.0.0/24 is subnetted, 1 subnets
C       20.0.0.0 is directly connected, FastEthernet0/1
     110.0.0.0/24 is subnetted, 1 subnets
O IA    110.0.0.0 [110/106] via 20.0.0.4, 00:03:39, FastEthernet0/1
     40.0.0.0/24 is subnetted, 1 subnets
O IA    40.0.0.0 [110/84] via 20.0.0.4, 00:03:40, FastEthernet0/1
     10.0.0.0/24 is subnetted, 1 subnets
C       10.0.0.0 is directly connected, FastEthernet0/0
O E2 199.0.0.0/24 [110/20] via 20.0.0.4, 00:03:40, FastEthernet0/1
     90.0.0.0/24 is subnetted, 1 subnets
O IA    90.0.0.0 [110/85] via 20.0.0.4, 00:03:40, FastEthernet0/1
     60.0.0.0/24 is subnetted, 1 subnets
O IA    60.0.0.0 [110/95] via 20.0.0.4, 00:03:40, FastEthernet0/1
     30.0.0.0/24 is subnetted, 1 subnets
O       30.0.0.0 [110/74] via 20.0.0.4, 00:03:40, FastEthernet0/1

It’s time to decipher this puzzle 

 


Type 1 (Router LSA)

 

  • Network route appear in the routing table as “O” for all routers on area and ” C “ for direclty connected ( check reference 2) O mean OSPF .
  • This LSA will be flooded to all the routers on the area & it ends at area boundaries.
  • Flooding mean that any router on the area will have all routers Type-1 LSA’s for that area. the way this done is that every router in the area will send every type-1 LSA it receive to other routers. sequence number are used to prevent duplication. 
  • Each router creates only 1 LSA that contains all links information under that OSPF process  (any update of that LSA will include all that router links),
  • LSA changes will make all routes re-run the full SPF tree ( you will see the sequence  number change )
  • Contain the router links information and as you can see on the photo we have point-to-point and broadcast lines.

OSPF-area-example

The way that a link information is described dependeds on the link type :
1 : Link connected to broadcast or NBMA network but with out neighbors.

described as Stub network

2 : Link connected to broadcast or NBMA network with neighbors.

described as Transit network

3 : Link connected to Point-to-Point 

described twice :  as Point-to-Point network  &  as Stub network (both at the same time)

Command output : 
this output is taken from Router 4 and when going to (reference 1)  you will see (3 under the links ) so where is the third link, since we know that R4 has only 2 connections. one of them point-to-point.

R4#show ip ospf database router self-originate

(self-originate option to view what this router created instead of viewing all of them ) 

(all routers on the area will have the following LSA + other routers LSA's ) 

OSPF Router with ID (4.4.4.4) (Process ID 1)

Router Link States (Area 1)

LS age: 44
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 4.4.4.4
Advertising Router: 4.4.4.4    ( this LSA is created by R4 )
LS Seq Number: 80000002  ( all links included in 1 message ) 
Checksum: 0xCD10
Length: 60
Number of Links: 3

Link connected to: another Router (point-to-point)
(Link ID) Neighboring Router ID: 5.5.5.5
(Link Data) Router Interface address: 30.0.0.4
Number of TOS metrics: 0
TOS 0 Metrics: 64

Link connected to: a Stub Network                                           
(Link ID) Network/subnet number: 30.0.0.0
(Link Data) Network Mask: 255.255.255.0
Number of TOS metrics: 0
TOS 0 Metrics: 64        ( notice that network 30 has a duplicated entry )

Link connected to: a Transit Network     ( Broadcast Network with neighbors )
(Link ID) Designated Router address: 20.0.0.4   
(Link Data) Router Interface address: 20.0.0.4( this ip will change according to the advertising router )
Number of TOS metrics: 0
TOS 0 Metrics: 10

now to simulate broadcast without neighbor we cut the link between R4 and R5 –R4 will advertise network 20.0.0.0 as Stub (notice it’s transit up there)

Link connected to: a Stub Network        ( Broadcast network with out neighbors ) 
(Link ID) Network/subnet number: 20.0.0.0
(Link Data) Network Mask: 255.255.255.0
Number of TOS metrics: 0
TOS 0 Metrics: 10

Points to be noted  : 

  • Stub network link information is : network IP & mask
  • P2P  network link information is : neighbor IP + router interface IP + ” Stub (which contain the network IP/mask)”
  • Transit network link information is : DR IP + router interface IP .

Now where is the Transit network mask & and network IP , Those will be included in the Type 2 which generated by the DR .

 


Type 2 (Network LSA)

 

  • Network routes appear in the routing table as O routes ( check reference 2)
  • It’s generated by the DR to other routers in the segment & it will be flooded like type 1 .
  • The DR is a centralized point, all routers in the segment become full adjacent with the DR/BDR only.
  • Topology change will make all routes re-run the full SPF tree
  • I have intentionally included 2 DR’s because some people don’t really understand the segment meaning .
    R3 connected to 2 segment’s each one of them has a DR, because DR is 1 per segment.

Same photo as Type-1 so you don’t scroll up

OSPF-area-example

Command output ( all routes on area 1 will those 2 LSA, one for each DR )

R1#show ip ospf database network

OSPF Router with ID (1.1.1.1) (Process ID 1)

Net Link States (Area 1)

Routing Bit Set on this LSA
LS age: 42
Options: (No TOS-capability, DC)
LS Type: Network Links
Link State ID: 10.0.0.2 (address of Designated Router)
Advertising Router: 2.2.2.2
LS Seq Number: 80000002  ( all links included in 1 message )
Checksum: 0x10F8
Length: 36
Network Mask: /24
Attached Router: 2.2.2.2
Attached Router: 1.1.1.1
Attached Router: 3.3.3.3

Routing Bit Set on this LSA
LS age: 1499
Options: (No TOS-capability, DC)
LS Type: Network Links
Link State ID: 20.0.0.4 (address of Designated Router)
Advertising Router: 4.4.4.4
LS Seq Number: 80000001  ( all links included in 1 message )
Checksum: 0x19DC
Length: 32
Network Mask: /24
Attached Router: 4.4.4.4
Attached Router: 3.3.3.3

until this point we have been dealing with networks inside area 1, Let’s have a look at how the networks within an area will be advertised into other areas.

that’s when type 3 come in .

 


Type 3 (Summary LSA)

 

  • appear on the routing table as O IA “IA = Inter-area” ( check reference 2)
  • The ABR create a type 3 LSA’s that tell an area about the networks in another area .
  • It doesn’t contain detailed topology information.It is just includes the network IP/mask “summary” 
  • This summary route informs routers  in an area about networks existence on other areas  .
  • R5 will create summary routes for 3 areas,
    • one for area 1 to tell that area about networks in area 0 &  area 2 (he knows about area 2 networks from the type 3 advertised by R10) ,
    • one for area 0 to tell it about networks in area 1,,
    • R10 and any other ABR will do the same job with the areas connect to it.
  • Change on LSA’s will not recalculate the full SPF tree line type 1 & 2 , partial SPF will only run for that network,  because unlike Type 1&2 there is a different LSA for each network with it’s own sequence number, so a partial SPF will run for this network (or this LSA which include 1 network) only .
  • The ABR creates a separate LSA for each network, so it doesn’t need to resend all networks again when ever one of them goes down it will only change that network LSA.
    OSPF-Type3Command output :
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: 536
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 40.0.0.0 (summary Network Number)
Advertising Router: 5.5.5.5
LS Seq Number: 80000009
Checksum: 0x3DB1
Length: 28
Network Mask: /24
TOS: 0 Metric: 10             ( ABR metric to network 40.0.0.0 ) 

Routing Bit Set on this LSA
LS age: 50
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 50.0.0.0 (summary Network Number)
Advertising Router: 5.5.5.5
LS Seq Number: 80000009
Checksum: 0x1FBB
Length: 28
Network Mask: /24
TOS: 0 Metric: 20    ( ABR metric to network 50.0.0.0 )

deleted network 60-70-80-90-100 to decrease the space.

Routing Bit Set on this LSA
LS age: 1550
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 110.0.0.0 (summary Network Number)
Advertising Router: 5.5.5.5
LS Seq Number: 80000008
Checksum: 0x8A09
Length: 28
Network Mask: /24
TOS: 0 Metric: 32     ( ABR metric to network 110 )

Type 5 (external)

 

  • Created by the ASBR when external routes (non-ospf routes)are injected into ospf.
  • Appear on the routing table as O E1 or OE2 ( check reference 2)
  • This LSA is flooded to all areas . and that’s why you won’t find that LSA categorized by area number like type 1 & 2 & 3 since all of them will have the same LSA from the same advertiser router.

the metric of this LSA has types :

  • type-1 metric : the metric will reflect the real metric (E1)( ASBR advertised cost + cost to reach the asbr )
  • type-2 metric : the metric will reflect the ASBRs advertised cost only (E2) which is 20 by default.

the forward-address is used to avoid extra hops (avoid sub-optimal routing)

  • i am going to create a separate topic on that matter but for now you may want to know that forward-address is set to non-zero for network 200 because of the NSSA area, i will explain why in another topic.

OSPF-Type5-

 

command output :

R3#show ip ospf database external

OSPF Router with ID (3.3.3.3) (Process ID 1)

Type-5 AS External Link States

Routing Bit Set on this LSA
LS age: 266
Options: (No TOS-capability, DC)
LS Type: AS External Link
Link State ID: 199.0.0.0 (External Network Number )
Advertising Router: 7.7.7.7             ( ASBR )
LS Seq Number: 80000010
Checksum: 0x6208
Length: 36
Network Mask: /24
Metric Type: 1 (Comparable directly to link state metric)
TOS: 0
Metric: 20              ( ASBR metric to the external network ) 
Forward Address: 0.0.0.0 ( find best path to the advertising router which is 7.7.7.7)
External Route Tag: 199

Routing Bit Set on this LSA
LS age: 1115
Options: (No TOS-capability, DC)
LS Type: AS External Link
Link State ID: 200.0.0.0 (External Network Number )
Advertising Router: 10.10.10.10       ( ASBR) 
LS Seq Number: 80000009
Checksum: 0xEF75
Length: 36
Network Mask: /24
Metric Type: 2 (Larger than any link state path)
TOS: 0
Metric: 20                       ( ASBR metric to the external network )
Forward Address: 110.0.0.11  (find best path to this address) 
External Route Tag: 200

example for metric-type effect :

R3 # show ip route

O E1 199.0.0.0/24 [110/114] via 20.0.0.4, 01:33:15, FastEthernet0/1

O E2 200.0.0.0/24 [110/20] via 20.0.0.4, 01:33:13, FastEthernet0/1

Now the important question is : how will R3 reach 7.7.7.7 ? (ASBR RID)

let’s take a look on all the information that R3 can see at ( reference 1 ). and try to find a connection to 7.7.7.7

remember the Type-3 contain only information about networks IP/MASK. but not who in that network.

the only connection i through type-4 LSA which advertised by R5 who has an interface on the area that 7.7.7.7 on it , so it has his type 1 .

 


Type 4 (asbr-summary )

 

  • Point to the ASBR (inform other routers how to reach that ASBR )
  • This LSA is injected by the ABR in all areas except the area that this ASBR is part of.
  • In our example R5 (the generators of type 4)  informs area 1 routers, to reach 10.10.10.10. & 7.7.7.7, send your data to me because i have there type1 LSA and i know to how reach them .
  • R9 is doing the same with area 3
  • In our example type 4 will not be advertised to area 0 . but it will to area 1 & area 3.

why ? because every router on area 0 received a type 1 from router 7 & router 10 and they knows how to reach them .

If we added R100 ASBR to area 1 , then you will find type 4 LSA for that ASBR in area 0 .

why ? because all routers in area 0 will not have a type 1 lsa for that R100.

Same as first photo.

command output :

R3#show ip ospf database asbr-summary

OSPF Router with ID (3.3.3.3) (Process ID 1)

Summary ASB Link States (Area 1)

Routing Bit Set on this LSA
LS age: 149
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(AS Boundary Router)
Link State ID: 7.7.7.7 (AS Boundary Router address)
Advertising Router: 5.5.5.5
LS Seq Number: 80000005
Checksum: 0x6291
Length: 28
Network Mask: /0
TOS: 0 Metric: 20             ( ABR metric to the ASBR)

Routing Bit Set on this LSA
LS age: 401
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(AS Boundary Router)
Link State ID: 10.10.10.10 (AS Boundary Router address)
Advertising Router: 5.5.5.5
LS Seq Number: 8000000E
Checksum: 0x349F
Length: 28
Network Mask: /0
TOS: 0 Metric: 31              ( ABR metric to the ASBR)

Type 4 mertric also help with choosing the best path to the ASBR when the forward address is set to 0.0.0.0 . ( imagine 2 ABR’s both saying we can reach the ASBR but each of them have a different metric )

now let’s take a step back to type 5,

as you can see that R10 is the advertiser for network 200.  

why not R11 ? and why R10 is advertised as AS Boundary Router address  (ASBR ) while the ASBR should connect OSPF with non-ospf ? Because R10 translated Type 7 to type 5 , so R10 is ABR & ASBR at the same time.

 


Type 7 (nssa-external)

 

  • created by the NSSA ASBR & it doesn’t leave the nssa area boundaries  .
  • like type 5 it has metric type-1 (N1) or type-2 metric (N2) . N1 will be be translated to E1 and N2 to E2
  • the ABR will convert the type 7 to type 5 and that type 5 will be flooded to all the OSPF domain .and that’s what makes that ABR to be ASBR as well . because it’s creating  type 5 .
  • type-4 will point to the ASBR which created the type 5 (R 10), but the forward-address inside type 5 will point to the actual ASBR which created type 7 ( R11 ) .

OSPF-Type5

 

command output.

R10#show ip ospf database nssa-external

OSPF Router with ID (10.10.10.10) (Process ID 1)

Type-7 AS External Link States (Area 2)

Routing Bit Set on this LSA
LS age: 36
Options: (No TOS-capability, Type 7/5 translation, DC)
LS Type: AS External Link
Link State ID: 200.0.0.0 (External Network Number )
Advertising Router: 11.11.11.11(when translated to type 5 the advertising router will be 10.10.10.10)
LS Seq Number: 80000001
Checksum: 0x4D12
Length: 36
Network Mask: /24
Metric Type: 2 (Larger than any link state path)
TOS: 0
Metric: 20
Forward Address: 110.0.0.11 ( same forward-adress as type-5)
External Route Tag: 200

the N2 or N1 will only appear on the routing table for the routers inside the NSSA.

R10#show ip route

O N2 200.0.0.0/24 [110/20] via 110.0.0.11, 00:01:14, FastEthernet1/0
80.0.0.0/24 is subnetted, 1 subnets
C 80.0.0.0 is directly connected, FastEthernet0/0
110.0.0.0/24 is subnetted, 1 subnets
C 110.0.0.0 is directly connected, FastEthernet1/0

Here is the link for the topology in GNS3

Click here to download

Standard

11 thoughts on “OSPF LSA Types

  1. Gmx says:

    Area 0 and Area 2 have both the “110” network… and the “10” is in Area 1… so what about ip 10.10.10.10 on R10 ?!? (confused)

    • abdo refky says:

      Hello GMX,
      Network 110 from area 2 will be sent to area 0 & 1 as “Type-3”
      check Reference 1 which taken from R3, you will see 110 under “type-3”

      10.10.10.10 is not an IP, it’s the router ID of router 10.
      check second photo note.

      feel free to ask any questions.

      Best regards.

    • abdo refky says:

      ah 🙂 drawing typing error.
      110 in area 0 is “100” , but i mistype it 110.
      i will correct that number on the drawing.
      Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.