OSPF Explained Step By Step With Practicals From CCNA To CCIE Level
LSA-1 Router LSA
LSA-2 Net Link LSA
LSA-3 Summary LSA
LSA-4 ASBR Summary LSA
LSA-5 External LSA
LSA-6 Multicast OSPF LSA
LSA-7 NSSA LSA
LSA-8 Link LSA //Used in OSPFv3
LSA-9 Intra Area Prefix LSA //Used in OSPFv3
LSA-10 & LSA-11 Opaque LSA
LSA-1 Dabase contains
* have info of link type
* network running on that link
* Connected DR on that link (on Multiaccess segment)
* Cost
* Age of the dabase
Router LSA contains all information of router
if any changes happen or any new network is added on router then router generate new LSA 1 and reflood in whole area and all router in same area will run spf and recalculate cost to reach that network
LSA-1 will be equal to number of routers present in that same area
Here is the view of the database on Ethernet Segment
In our case we are using 2 routers with Area0
Both routers will have same database, we can go to any of the router and can check the database
R1#sh ip ospf database
OSPF Router with ID (1.1.1.1) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 20 0x80000002 0x008178 2
2.2.2.2 2.2.2.2 21 0x80000002 0x00717B 2
Same output we can get while checking database on R2
R2#sh ip ospf database
OSPF Router with ID (2.2.2.2) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 20 0x80000002 0x005138 2
2.2.2.2 2.2.2.2 21 0x80000002 0x00757B 2
Database Fields
* Link ID
Link Id is equal to Router ID
Using Link ID we can check the detailed view of database
* ADV Router
The advertising router Router ID
Whenever a router originate Database and advertise to other routers, it use its own router ID in this field
* Age
This show from how long the database is here
If router gets a new database this age will start from 0
Max age of a database can be 3600 sec, if did not get the packet till 3600 sec it will flush the database
* Seq#
Seq number is used to prevent Loop in OSPF database
Only generated by the originator of database
Other routers cannot change the database seq number
Always start with 0x80000001
* Checksum
Whenever a router originate a database it adds a checksum value
Used to check the database integrity
Whenever any router gets the database it also run checksum and find the value
Database will be accepted If new checksum value is same as received in database
Database will be dropped if new checksum value is different as received in database
If any collision happens in between checksum value will be diff
* Link count
This share the exact number of link count present in database
Lets check the database using Link ID
R1#sh ip ospf database router 1.1.1.1
OSPF Router with ID (1.1.1.1) (Process ID 1)
Router Link States (Area 0)
LS age: 688
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 1.1.1.1
Advertising Router: 1.1.1.1
LS Seq Number: 80000002
Checksum: 0x8178
Length: 48
Number of Links: 2
Link connected to: a Stub Network
(Link ID) Network/subnet number: 1.1.1.1
TOS 0 Metrics: 1
Link connected to: a Transit Network
(Link ID) Designated Router address: 12.0.0.2
(Link Data) Router Interface address: 12.0.0.1
Number of MTID metrics: 0
TOS 0 Metrics: 1
Loopback address are considered as Stub Networks
Ethernet segments are considered as Transit Networks
Here is the view of the database on Serial Segment
R1#show ip ospf database
OSPF Router with ID (1.1.1.1) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 26 0x80000005 0x00F071 3
2.2.2.2 2.2.2.2 28 0x80000004 0x0090C9 3
When we have serial links between routers they consider one serial link as 2 count
* Point-to-Point link: share the information of connected neighbor and own interface address
* Stub network: share the information of network ID and subne masked on the interface
R1#show ip ospf database router 1.1.1.1
OSPF Router with ID (1.1.1.1) (Process ID 1)
Router Link States (Area 0)
LS age: 96
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 1.1.1.1
Advertising Router: 1.1.1.1
LS Seq Number: 80000005
Checksum: 0xF071
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
Number of MTID 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.0.0.1
Number of MTID metrics: 0
TOS 0 Metrics: 64
Link connected to: a Stub Network
(Link ID) Network/subnet number: 12.0.0.0
(Link Data) Network Mask: 255.0.0.0
Number of MTID metrics: 0
TOS 0 Metrics: 64
*Have information of other neighbors that are connected on that segment
* LSA2 only present on ethernet links
* On serial we can have only 2 routers so we dont need LSA-2 to share neighbor details
* On serial link LSA-1 contains neighbor information
* LSA2 contains the subnetmask details running on that segment
* DR&BDR Roles considered in this LSA
* DR and BDR listen on multicast add of 224.0.0.6 & 224.0.0.6
* DR other listen on multicast add of 224.0.0.5
* LSA-2 will be equal to number of ethernet segment in that area
R1#sh ip ospf database
OSPF Router with ID (1.1.1.1) (Process ID 1)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
2.2.2.2 2.2.2.2 116 0x80000007 0x006780 2
Net Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
12.0.0.2 2.2.2.2 116 0x80000001 0x0029EE
Here we can see the LSA-2 Database,
* Link ID: Link ID is the physical interface address of DR router that is pointing towards LAN segment & is used to check
detailed view of the database
* ADV Router: Router-ID of Designated Router
* Age: As same as LSA-1
* Seq# As same as LSA-1
* Checksum As same as LSA-1
Lets check the detailed view of Database
R1#sh ip ospf data network 12.0.0.02
OSPF Router with ID (1.1.1.1) (Process ID 1)
Net Link States (Area 0)
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 340
Options: (No TOS-capability, DC)
LS Type: Network Links
Link State ID: 12.0.0.2 (address of Designated Router)
Advertising Router: 2.2.2.2
LS Seq Number: 80000001
Checksum: 0x29EE
Length: 32
Network Mask: /8
Attached Router: 2.2.2.2
Attached Router: 1.1.1.1
Here we can see the all the neighbors attached on the ethernet segment and LSA-2 share the Network Mask what all the neigbors are using
Dual Area Concept & Working with LSA
Whenever a router is the part of 2 different area and one of them is the Area-0, that router will act as ABR (Area Border Router)
Whenever a router become ABR, first it send LSA-1 with B bit enable in Flag to let the router knows who is ABR for this area
Then router originate LSA-3 and send to Area
* ABR is responsible for generating this LSA
* this LSA have info of another area routes
* ABR is a router who has at least one single interface in area o and other interface in diff area
* have information of all links and send all link information of one area to another area in the form of summary LSA
* if area 1 has 4 network and 2 ABR is present there then 8 summery LSA will be flood on area 0
* ABR use prefix address as Link-ID in LSA-3
* Routing code for Inter-Area routes / LSA-3 routes is O IA
While installing the LSA-3 in routing table, router use O IA code
Lets do a LAB and will verify all the possible inputs and metrics.
R1 Configuration | R2 Configuration | R3 Configuration | R4 Configuration |
---|---|---|---|
router ospf 1 | router ospf 1 | router ospf 1 | router ospf 1 |
network 1.1.1.1 0.0.0.0 area 0 | network 2.2.2.2 0.0.0.0 area 1 | network 3.3.3.3 0.0.0.0 area 1 | network 4.4.4.4 0.0.0.0 area 0 |
network 12.0.0.0 0.255.255.255 area 0 | network 12.0.0.0 0.255.255.255 area 0 | network 23.0.0.0 0.255.255.255 area 1 | network 14.0.0.0 0.255.255.255 area 0 |
network 14.0.0.0 0.255.255.255 area 0 | network 23.0.0.0 0.255.255.255 area 1 |
Once R2 becomes ABR, it will generate LSA-1 again with B bit enable to let the routers know about ABR
Once router send LSA-1, the next step is, it will verify how many prefixes are present in other area and will convert all the prefixes to LSA-3
LSA-3 will be equal to number of prefixes present in other area
In this topology we can see total 4 prefixes in Area-0( 1.1.1.1, 4.4.4.4, 12.0.0.0, 14.0.0.0), now ABR will generate LSA-3 for all these prefixes
Lets check on R3 database
R3 Database
R3#show ip ospf database
OSPF Router with ID (3.3.3.3) (Process ID 1)
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
1.1.1.1 2.2.2.2 1259 0x80000001 0x0033FB
4.4.4.4 2.2.2.2 1259 0x80000001 0x00B26F
12.0.0.0 2.2.2.2 1259 0x80000001 0x00BA6D
14.0.0.0 2.2.2.2 1259 0x80000001 0x00AA7A
* Link ID : is the real prefix address present in other area
* ADV Rotuer : is the ABR router ID
* Age : from how long Router is holding the database
* Seq# : is the sequence number of database generated by ABR
* Checksum : checksum value added by ABR
Metric calculation in LSA-3
Whenever we try to calculate metric for prefixes received in LSA-3, it has few combination
In this case router 3 has LSA-3 4.4.4.4, lets do the metric calculation for this route
The metric received in LSA-4 for 4.4.4.4 is 3
R3 Database LSA-3
R3#sh ip ospf database summary 4.4.4.4
OSPF Router with ID (3.3.3.3) (Process ID 1)
Summary Net Link States (Area 1)
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 111
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(Network)
Link State ID: 4.4.4.4 (summary Network Number)
Advertising Router: 2.2.2.2
LS Seq Number: 80000002
Checksum: 0xB070
Length: 28
Network Mask: /32
MTID: 0 Metric: 3
* The metric we see in LSA-3 is from ABR to destination prefix
Then router check what is the metric from me to ABR router, and use LSA-1 to find the metric
In our case, ABR is very next router
Database LSA-1 of ABR on R3
R3#sh ip ospf database router 2.2.2.2
OSPF Router with ID (3.3.3.3) (Process ID 1)
Router Link States (Area 1)
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 1247
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 2.2.2.2
Advertising Router: 2.2.2.2
LS Seq Number: 80000008
Checksum: 0x4E80
Length: 48
Area Border Router
Number of Links: 2
Link connected to: a Stub Network
(Link ID) Network/subnet number: 2.2.2.2
(Link Data) Network Mask: 255.255.255.255
Number of MTID metrics: 0
TOS 0 Metrics: 1
Link connected to: a Transit Network
(Link ID) Designated Router address: 23.0.0.3
(Link Data) Router Interface address: 23.0.0.2
Number of MTID metrics: 0
TOS 0 Metrics: 1
* So from R3 to Reach ABR, metric is 1
Now the router R3 will add LSA-3 Metric and LSA01 Metric ( 3 + 1 ) = 4
So when we check the routing table we see the total metric to reach the destination
R3 Routing Table
R3#sh ip route ospf
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
+ - replicated route, % - next hop override
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
O IA 1.1.1.1 [110/3] via 23.0.0.2, 00:23:15, FastEthernet1/0
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/2] via 23.0.0.2, 00:23:15, FastEthernet1/0
4.0.0.0/32 is subnetted, 1 subnets
O IA 4.4.4.4 [110/4] via 23.0.0.2, 00:23:15, FastEthernet1/0
Summarization of LSA-3
* TYPE3 LSA can only be filter on ABR router (both in and out direction)
* ABR use least cost with the summarized LSA.
* (Least cost: Any prefix that has least cost will be taken for Summary address)
* ABR perform summarization up-to the time it having at least one subnet of summery in its routing table as intra area route.
Summary of LSA-3
Router ospf 1
Area 0 range 1.1.0.0 255.255.0.0 // (area 1) from which networks are belong.
Exit
Database on R3
R3#sh ip ospf database
OSPF Router with ID (3.3.3.3) (Process ID 1)
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
1.1.0.0 2.2.2.2 16 0x80000001 0x0048E8
* LSA-1 Have B-bit enable in Update Flag
( that represent ABR info if that router is ABR then B bit will be 1 if not then B bit will be 0)
Filtering of LSA-3
Here R3 is getting 4 prefixes as LSA-3
R3 Database
R3#show ip ospf data
OSPF Router with ID (3.3.3.3) (Process ID 1)
Router Link States (Area 1) …
Net Link States (Area 1) …
Summary Net Link States (Area 1)
Link ID ADV Router Age Seq# Checksum
1.1.1.1 2.2.2.2 12 0x80000001 0x0033FB
4.4.4.4 2.2.2.2 930 0x80000002 0x00B070
12.0.0.0 2.2.2.2 930 0x80000002 0x00B86E
14.0.0.0 2.2.2.2 930 0x80000002 0x00A87B
Lets filter 1.1.1.1 on ABR, only ABR will have power to filter LSA-3
* Filtering can be applied in IN or OUT direction
* Prefix-list is used to filter the LSA-3
ip prefix-list R1Pre deny 1.1.1.1/32
ip prefix-list R1Pre permit 0.0.0.0/0 le 32
* 1.1.1.1 belongs to Area-0
We have 2 option, we can use any if the way to filter database
Area 0 filter-list prefix R1Pre out //Filter networks sent from this area
Area 1 filter-list prefix R1pre in //Filter networks sent to this area
R3 Database
R3#show ip ospf database
OSPF Router with ID (3.3.3.3) (Process ID 1)
Router Link States (Area 1) …
Net Link States (Area 1) …
Summary Net Link States (Area 1)
4.4.4.4 2.2.2.2 1338 0x80000002 0x00B070
12.0.0.0 2.2.2.2 1338 0x80000002 0x00B86E
14.0.0.0 2.2.2.2 1338 0x80000002 0x00A87B
So new we are not getting 1.1.1.1 prefix as LSA-3
* If ASBR is generating LSA-5 and OSPF domain has other area connected to Area-0 then ABR will generate LSA-4 on another area and inject info and cost to reach ASBR.
* LSA4 Contains cost from ABR to ASBR
* In LSA-4 ABR tell the way how to reach ASBR in diff area.
* ABR use ASBR router-ID as Link ID in LSA-4
* LSA-4 Contains
ADV R-RID of ASBR, Checksum, Sequence number, Cost of ABR to reach ASBR
Here we have R3 as ASBR, now when R4 receives LSA-5, so it does not have any database to reach ASBR, so ABR generates LSA-4 including the cost to reach from ABR to ASBR
Lets check the database on R4
Router-R4 database
R4#show ip ospf database
OSPF Router with ID (4.4.4.4) (Process ID 1)
Router Link States (Area 0)...
Net Link States (Area 0)...
Summary Net Link States (Area 0)...
Summary ASB Link States (Area 0)
Link ID ADV Router Age Seq# Checksum
3.3.3.3 2.2.2.2 677 0x80000001 0x00BE68
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
5.5.5.5 3.3.3.3 682 0x80000001 0x00A6D9 0
35.0.0.0 3.3.3.3 682 0x80000001 0x00C4AC 0
Here we can see, in LSA-5 we can see advertising router is 3.3.3.3 and ABR is generating LSA-4 to let the router knows how to reach ASBR and what is the cost
Router-4 Database
R4#show ip ospf database asbr-summary 3.3.3.3
OSPF Router with ID (4.4.4.4) (Process ID 1)
Summary ASB Link States (Area 0)
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 1491
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(AS Boundary Router)
Link State ID: 3.3.3.3 (AS Boundary Router address)
Advertising Router: 2.2.2.2
LS Seq Number: 80000003
Checksum: 0xBA6A
Length: 28
Network Mask: /0
MTID: 0 Metric: 1
So we can see now the cost is 1 from ABR to reach ASBR router, so now router can easily do the calculation for LSA-5
* ASBR is responsible for generating this LSA
* This LSA have all external routes
* Routes are redistributed with E1(External-1) and E2(External-2) code
By default E2 is active
E2 routes do not add matric every hop
E1 routes do add all the path metric of the transit routers
E1 is more preferred over E2 routes
* LSA5 is area independent(will flood in whole domain)
* By default ASBR use Metric 20 with all the redistributed routes
* Type 5 LSA will be equal to no of redistributed routes
* Whenever a router becomes ASBR, it sends the LSA-1 first with E bit enable
* E bit is used to let the Same Area routers knows about ASBR
* After sending this LSA-1 with E bit, ASBR advertise LSA-5 to the domain
LSA-1 with E bit enable
LSA-5 containing the external routes
How to redistribute external routes in OSPF
* Here R5 EIGRP protocol contains 2 prefixes (5.5.5.5 & 35.0.0.0)
* Lets redistribute routes
Redistribution on R3 from EGRP to OSPF
router ospf 1
redistribute eigrp 1 //using this command, only classfull routes will be redistributed
redistribute eigrp 1 subnets //using this command, Classfull and Classless routes will be redistributed
redistribute eigrp 1 subnets metric 40 //using this command, we can change default emtric from 20 to 40
redistribute eigrp 1 subnets metric-type 1 //using this command, we can change metric type from E2 to E1
redistribute eigrp 1 subnets route-map specific //using Route-map we can control the redistributed routes(using ACL or Prefix-list)
exit
E-1 Metric calculation of LSA-5
1. Within the same Area
2. In other area
1.Within the same Area
Whenever a router try to calculate the metric for external routes they use combination of LSA-5 and LSA-1
LSA-5 contains metric from ASBR to Destination prefix (default value is 20)
LSA-1 contains metric from Router to ASBR
Here R2 will try to do the metric calculation
1. Metric from LSA-5
a. This contains 20 metric
R2#show ip ospf database external 5.5.5.5
OSPF Router with ID (2.2.2.2) (Process ID 1)
Type-5 AS External Link States
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 21
Options: (No TOS-capability, DC, Upward)
LS Type: AS External Link
Link State ID: 5.5.5.5 (External Network Number )
Advertising Router: 3.3.3.3
LS Seq Number: 80000004
Checksum: 0x1DE0
Length: 36
Network Mask: /32
Metric Type: 1 (Comparable directly to link state metric)
MTID: 0
Metric: 20
Forward Address: 0.0.0.0
External Route Tag: 0
2.Metric from LSA-1 from R2 to ASBR
a. This contains 1 metric
R2#show ip ospf data router 3.3.3.3
OSPF Router with ID (2.2.2.2) (Process ID 1)
Router Link States (Area 1)
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 1339
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 3.3.3.3
Advertising Router: 3.3.3.3
LS Seq Number: 80000004
Checksum: 0x497B
Length: 48
AS Boundary Router
Number of Links: 2
Link connected to: a Stub Network
(Link ID) Network/subnet number: 3.3.3.3
(Link Data) Network Mask: 255.255.255.255
Number of MTID metrics: 0
TOS 0 Metrics: 1
Link connected to: a Transit Network
(Link ID) Designated Router address: 23.0.0.3
(Link Data) Router Interface address: 23.0.0.3
Number of MTID metrics: 0
TOS 0 Metrics: 1
3. Now total using LSA-5 + LSA-1 ( 20 + 1 ) = 21
4. Check the routing table
a. This contains 21
R2#show ip route ospf
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
+ - replicated route, % - next hop override
Gateway of last resort is not set
O E1 5.5.5.5 [110/21] via 23.0.0.3, 00:54:51, FastEthernet1/0
2. In other area
Whenver a router try to calculate the metric for external routes they use combination of LSA-5 & LSA-4 and LSA-1
LSA-5 contains metric from ASBR to Destination prefix(default value is 20)
LSA-4 contains metric from ABR to ASBR
LSA-1 contains metric from Router to ABR
Lets check on R4
LSA-5 Database [Contains metric from ASBR to destination prefix]
R4 database for External LSA 5.5.5.5 //It contains 20 metric
R4#show ip ospf database external 5.5.5.5
OSPF Router with ID (4.4.4.4) (Process ID 1)
Type-5 AS External Link States
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 158
Options: (No TOS-capability, DC, Upward)
LS Type: AS External Link
Link State ID: 5.5.5.5 (External Network Number )
Advertising Router: 3.3.3.3
LS Seq Number: 80000004
Checksum: 0x1DE0
Length: 36
Network Mask: /32
Metric Type: 1 (Comparable directly to link state metric)
MTID: 0
Metric: 20
Forward Address: 0.0.0.0
External Route Tag: 0
LSA-4 Database [Contains metric from ABR to ASBR]
R4 database for LSA-4 /it contains 1 metric
R4#show ip ospf database asbr-summary 3.3.3.3
OSPF Router with ID (4.4.4.4) (Process ID 1)
Summary ASB Link States (Area 0)
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 953
Options: (No TOS-capability, DC, Upward)
LS Type: Summary Links(AS Boundary Router)
Link State ID: 3.3.3.3 (AS Boundary Router address)
Advertising Router: 2.2.2.2
LS Seq Number: 80000003
Checksum: 0xBA6A
Length: 28
Network Mask: /0
MTID: 0 Metric: 1
LSA-1 Database [Contains metric from Router to ABR]
* From R4 to ABR(R2)
* In our case from R4 to R2 cost is 2
Now Lets add all the metrics
Database | Metric |
LSA-5 | 20 |
LSA-4 | 1 |
LSA-1 | 2 |
Total | 23 |
Lets check the Routing table what it has
R4 Routing table
R4#show ip route ospf
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/2] via 14.0.0.1, 01:25:32, FastEthernet1/0
2.0.0.0/32 is subnetted, 1 subnets
O IA 2.2.2.2 [110/3] via 14.0.0.1, 01:25:32, FastEthernet1/0
3.0.0.0/32 is subnetted, 1 subnets
O IA 3.3.3.3 [110/4] via 14.0.0.1, 01:25:32, FastEthernet1/0
5.0.0.0/32 is subnetted, 1 subnets
O E1 5.5.5.5 [110/23] via 14.0.0.1, 00:10:03, FastEthernet1/0
This is how metric calculation is done in case of External Type-1
E-2 Metric calculation of LSA-5
1. Within the same Area
2. In other area
1. Within the same Area
* Whenever a router try to calculate the metric for external routes they use only metric advertised by ASBR
* LSA-5 contains metric from ASBR to Destination prefix (default value is 20)
Here R2 will try to do the metric calculation
1.Metric from LSA-5
a.This contains 20 metric
R2#show ip ospf database external 5.5.5.5
OSPF Router with ID (2.2.2.2) (Process ID 1)
Type-5 AS External Link States
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 1242
Options: (No TOS-capability, DC, Upward)
LS Type: AS External Link
Link State ID: 5.5.5.5 (External Network Number )
Advertising Router: 3.3.3.3
LS Seq Number: 80000002
Checksum: 0xA4DA
Length: 36
Network Mask: /32
Metric Type: 2 (Larger than any link state path)
MTID: 0
Metric: 20
Forward Address: 0.0.0.0
External Route Tag: 0
2. Check the routing table
a.This contains 20
R2#show ip route ospf
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
+ - replicated route, % - next hop override
Gateway of last resort is not set
O E2 5.5.5.5 [110/20] via 23.0.0.3, 00:54:51, FastEthernet1/0
2. In other area
* Same as Above Same Area metric calcualtion, in E2 type routers only use the metric advertise by ASBR
* LSA-5 contains metric from ASBR to Destination prefix(default value is 20)
Here R4 will check only metric advertise by ASBR in LSA-5
R4 Database, External LSA
R4#show ip ospf database external 5.5.5.5
OSPF Router with ID (4.4.4.4) (Process ID 1)
Type-5 AS External Link States
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 398
Options: (No TOS-capability, DC, Upward)
LS Type: AS External Link
Link State ID: 5.5.5.5 (External Network Number )
Advertising Router: 3.3.3.3
LS Seq Number: 80000003
Checksum: 0xA2DB
Length: 36
Network Mask: /32
Metric Type: 2 (Larger than any link state path)
MTID: 0
Metric: 20
Forward Address: 0.0.0.0
External Route Tag: 0
In routing table it will have the same metric Value
R4 routing table
R4#show ip route ospf
Gateway of last resort is not set
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/2] via 14.0.0.1, 01:14:11, FastEthernet1/0
2.0.0.0/32 is subnetted, 1 subnets
O IA 2.2.2.2 [110/3] via 14.0.0.1, 01:14:11, FastEthernet1/0
3.0.0.0/32 is subnetted, 1 subnets
O IA 3.3.3.3 [110/4] via 14.0.0.1, 01:14:11, FastEthernet1/0
5.0.0.0/32 is subnetted, 1 subnets
O E2 5.5.5.5 [110/20] via 14.0.0.1, 01:12:27, FastEthernet1/0
LSA-5 Summerization on ASBR
LSA-5 Summary can be done only on ASBR
After redistributing external routes we can do summarization
Router-5 Summerization
Router ospf 1
summary-address 5.0.0.0 255.0.0.0
exit
LSA-5 Filtering on ASBR
* LSA-5 can be filtered only on ASBR
a. We control routes at the time of redistribution by adding a route-map with specific prefixes
b. We can actively filter LSA-5 after redistribution using distribute-list
External Database of R3 //LSA-5
R3#show ip ospf data
OSPF Router with ID (3.3.3.3) (Process ID 1)
Router Link States (Area 1)...
Net Link States (Area 1)...
Summary Net Link States (Area 1)...
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
5.5.5.5 3.3.3.3 1383 0x80000001 0x0023DD 0
35.0.0.0 3.3.3.3 713 0x80000005 0x0039B4 0
Now lets filter 5.5.5.5 using distribute list feature
Filtering of LSA-5 on R3
Create ACL to match the prefixes
access-list 1 deny 5.5.5.5 0.0.0.0
access-list 1 permit any
Use distribute-list inside OSPF
router ospf 1
distribute-list 1 out eigrp 1
Now after filtering, lets check the database
R3 database for LSA-5
R3#show ip ospf data
OSPF Router with ID (3.3.3.3) (Process ID 1)
Router Link States (Area 1)...
Net Link States (Area 1)...
Summary Net Link States (Area 1)...
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
35.0.0.0 3.3.3.3 913 0x80000005 0x0039B4 0
When we have such requirement, where we dont want to receive any external routes from other area but that area itself is connected to other protocol and wants to do the redistribution
In such condition/requirements we configure NSSA area, and redistributed routes in NSSA area originated as LSA-7
* Metric type N1 & N2(by-default)
* Metric is 20 by-default
* if a router is in NSSA area then it will generate LSA7 and LSA7 have a forwarding add(highest ospf loopback address) in update and ABR will translate LSA7 to LSA5 for another area.
* LSA-7 scope is local to area
* Only one ABR can do the translation from LSA-7 to LSA-5
* NSSA area should be enable on all the routers present in that area
* When we enable NSSA area, the router will send hello packet with N bit enable(NSSA Capability)
*The ABR with the highest RID will perform a translation from type-7 to type-5 LSA.
*N2 is preferred over E2.
*If forwarding address is present in N2 and not present in E2 and ABR is receiving both then it will choose best path by checking lowest cost of forward address to reach that network.
After redistributing external routes on R3, it will add database in Type-7 LSA
Router 3 database //LSA-7
R3#show ip ospf database
OSPF Router with ID (3.3.3.3) (Process ID 1)
Router Link States (Area 1)...
Net Link States (Area 1)...
Type-7 AS External Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Tag
5.5.5.5 3.3.3.3 1 0x80000001 0x00A8C1 0
35.0.0.0 3.3.3.3 1 0x80000001 0x00C694 0
R3#show ip ospf database nssa-external 5.5.5.5
OSPF Router with ID (3.3.3.3) (Process ID 1)
Type-7 AS External Link States (Area 1)
LS age: 266
Options: (No TOS-capability, Type 7/5 translation, DC, Upward)
LS Type: AS External Link
Link State ID: 5.5.5.5 (External Network Number )
Advertising Router: 3.3.3.3
LS Seq Number: 80000001
Checksum: 0xA8C1
Length: 36
Network Mask: /32
Metric Type: 2 (Larger than any link state path)
MTID: 0
Metric: 20
Forward Address: 3.3.3.3
External Route Tag: 0
In above output, R3 is picking OSPF highest loopback address as forward address,and if loopback is not present on router then it will choose physical ospf enabled interface as forwarding address.
Forward address is being used by routers to find a best and quick path to reach destination, instead of going via the advertising router, they choose forward address to communicate
When we have 2 ABR in domain so the router with highest router id will perform the translation from LSA-7 to LSA-5
Lets check the output
Router-2 output ABR-1
R2#show ip ospf
Routing Process "ospf 1" with ID 2.2.2.2
It is an area border and autonomous system boundary router
Redistributing External Routes from,
Area 1
Number of interfaces in this area is 2 (1 loopback)
It is a NSSA area
Area has no authentication
SPF algorithm last executed 00:08:49.296 ago
SPF algorithm executed 10 times
Router-6 output ABR-2
R6#show ip ospf
Routing Process "ospf 1" with ID 6.6.6.6
It is an area border and autonomous system boundary router
Redistributing External Routes from,
Area 1
Number of interfaces in this area is 1
It is a NSSA area
Perform type-7/type-5 LSA translation
Area has no authentication
SPF algorithm last executed 00:09:03.820 ago
SPF algorithm executed 10 times
Now here we can see Router-6 has the highest Router ID and is doing the translation from Type-7 to Type-5.
While doing the translation it will copy and paste the forward address in LSA-5 to let the other router knows how to reach or which address they can directly use to communicate.
Lets check the database on other area router who have LSA-5
Router-1 Database
R1#show ip ospf database external 5.5.5.5
OSPF Router with ID (1.1.1.1) (Process ID 1)
Type-5 AS External Link States
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 1201
Options: (No TOS-capability, DC, Upward)
LS Type: AS External Link
Link State ID: 5.5.5.5 (External Network Number )
Advertising Router: 6.6.6.6
LS Seq Number: 80000001
Checksum: 0xE285
Length: 36
Network Mask: /32
Metric Type: 2 (Larger than any link state path)
MTID: 0
Metric: 20
Forward Address: 3.3.3.3
External Route Tag: 0
Router-1 Routing table
R1#show ip route 5.5.5.5
Routing entry for 5.5.5.5/32
Known via "ospf 1", distance 110, metric 20, type extern 2, forward metric 3
Last update from 12.0.0.2 on FastEthernet0/0, 00:20:28 ago
Routing Descriptor Blocks:
* 12.0.0.2, from 6.6.6.6, 00:20:28 ago, via FastEthernet0/0
Route metric is 20, traffic share count is 1
Here we can see Advertising router of database is Router-6 but Router-1 is installing the route on behalf of forward address via Router-2
Summerization & Translation Control
When we need summary address but dont want ABR to do translation for that
Router-R3
router ospf 1
summary-address 5.0.0.0 255.0.0.0 nssa-only
exit
Lets check the database on Router 1 & Router 2
Router-2 Database
R2#show ip ospf database
OSPF Router with ID (2.2.2.2) (Process ID 1)
Router Link States (Area 0)...
Net Link States (Area 0)...
Summary Net Link States (Area 0)...
Router Link States (Area 1)...
Net Link States (Area 1)...
Summary Net Link States (Area 1)...
Type-7 AS External Link States (Area 1)
Link ID ADV Router Age Seq# Checksum Tag
5.0.0.0 3.3.3.3 108 0x80000001 0x00C6BA 0
35.0.0.0 3.3.3.3 1814 0x80000001 0x00C694 0
Router-1 Database
R1#show ip ospf database
OSPF Router with ID (1.1.1.1) (Process ID 1)
Router Link States (Area 0)
Net Link States (Area 0)
Summary Net Link States (Area 0)
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
35.0.0.0 6.6.6.6 1899 0x80000001 0x000158 0
Here we can see summary address on Router-2 in Area-1 but do not see the translated address in Router-1 database
Remove Forwarder address from LSA-7
* A user can also remove forward address from the translation of LSA-7 to LSA-5 if required
* We need to execute this command on ABR router
* After this router will use the path via advertising router
Router-6
Router ospf 1
area 1 nssa translate type7 suppress-fa
exit
Lets check the database and Routing table of Router-1
Rotuer-1 LSA-5
R1#sh ip ospf data external 5.0.0.0
OSPF Router with ID (1.1.1.1) (Process ID 1)
> Type-5 AS External Link States
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 129
Options: (No TOS-capability, DC, Upward)
LS Type: AS External Link
Link State ID: 5.0.0.0 (External Network Number )
Advertising Router: 6.6.6.6
LS Seq Number: 80000002
Checksum: 0xEF92
Length: 36
Network Mask: /8
Metric Type: 2 (Larger than any link state path)
MTID: 0
Metric: 20
Forward Address: 0.0.0.0
External Route Tag: 0
Router-1 Routing table
R1#show ip route 5.0.0.0
Routing entry for 5.0.0.0/8
Known via "ospf 1", distance 110, metric 20, type extern 2, forward metric 2
Last update from 14.0.0.4 on FastEthernet1/0, 00:02:42 ago
Routing Descriptor Blocks:
* 14.0.0.4, from 6.6.6.6, 00:02:42 ago, via FastEthernet1/0
Route metric is 20, traffic share count is 1
Now here we can see the Database does not have forward address and router is using the longest path via Router-6
Force ABR to translate from Type-7 to Type-5
If we need a ABR to forcefully translate the Type-7 to Type-5 translation we can use this feature
Router-2 ABR
router ospf 1
area 1 nssa translate type7 always
exit
Lets check the behaviour on Both ABR
Router-2 status
R2#show ip ospf
Routing Process "ospf 1" with ID 2.2.2.2
Area 1
Number of interfaces in this area is 2 (1 loopback)
It is a NSSA area
Configured to translate Type-7 LSAs
Perform type-7/type-5 LSA translation
Area has no authentication
SPF algorithm last executed 00:00:06.752 ago
SPF algorithm executed 11 times
Router-6 status
R6#show ip ospf
Routing Process "ospf 1" with ID 6.6.6.6
Area 1
Number of interfaces in this area is 1
It is a NSSA area
Area has no authentication
SPF algorithm last executed 00:00:13.180 ago
SPF algorithm executed 12 times
Here we can see, Router with the lower Router-ID is doing the translation forcefully.
* Link LSAs have local-link flooding scope and are never flooded beyond the link with which they are associated.
* Link LSAs provide the link-local address of the router to all other routers that are attached to the link.
T
* They inform other routers that are attached to the link of a list of prefixes to associate with the link.
* In addition, they allow the router to assert a collection of option bits to associate with the Network LSA that will be originated for the link.
* In case of OSPFv3 or OSPF with IPv6 this LSA gets generated
Configuration:
//In case of only IPv6 address we need to define Router-ID manually, otherwise router will not be able to initiate OSPF process without any Router-ID
//Router-ID will always be a 32bit number in dotted decimal form
Router-1 Config
ipv6 unicast-routing
interface fastEthernet 0/0
ipv6 address 12::1/64
no shutdown
exit
interface loopback 0
ipv6 address 1::1/128
exit
router ospfv3 1
address-family ipv6
router-id 1.1.1.1
exit
interface range fastEthernet 0/0, loopback 0
ospfv3 1 ipv6 area 0
exit
Router-2 Config
ipv6 unicast-routing
interface fastEthernet 0/0
ipv6 address 12::2/64
no shutdown
exit
int loopback 0
ipv6 address 2::2/128
exit
router ospfv3 1
add ipv6
router-id 2.2.2.2
exit
interface range fastEthernet 0/0, loopback 0
ospfv3 1 ipv6 area 0
exit
Neighbor status
Router-2 Neighbor status
R2#show ospfv3 neighbor
OSPFv3 1 address-family ipv6 (router-id 2.2.2.2)
Neighbor ID Pri State Dead Time Interface ID Interface
1.1.1.1 1 FULL/DR 00:00:33 2 FastEthernet0/0
LSA-8 Dabase on Router-2
Router-2 Database | Link LSA
R2#show ospfv3 database
OSPFv3 1 address-family ipv6 (router-id 2.2.2.2)
Router Link States (Area 0)...
Net Link States (Area 0)...
Link (Type-8) Link States (Area 0)
ADV Router Age Seq# Link ID Interface
1.1.1.1 307 0x80000001 2 Fa0/0
2.2.2.2 232 0x80000001 2 Fa0/0
Now lets check the inside view of the database what exactly it is holding, using Link-ID
Router-2 Database | Link LSA | Inside view
R2#show ospfv3 database Link 2
OSPFv3 1 address-family ipv6 (router-id 2.2.2.2)
Link (Type-8) Link States (Area 0)
LS age: 428
Options: (V6-Bit, E-Bit, R-bit, DC-Bit)
LS Type: Link-LSA (Interface: FastEthernet0/0)
Link State ID: 2 (Interface ID)
Advertising Router: 1.1.1.1
LS Seq Number: 80000001
Checksum: 0xEFFB
Length: 56
Router Priority: 1
Link Local Address: FE80::C801:EFF:FE6E:0
Number of Prefixes: 1
Prefix Address: 12::
Prefix Length: 64, Options: None
LS age: 353
Options: (V6-Bit, E-Bit, R-bit, DC-Bit)
LS Type: Link-LSA (Interface: FastEthernet0/0)
Link State ID: 2 (Interface ID)
Advertising Router: 2.2.2.2
LS Seq Number: 80000001
Checksum: 0x32B0
Length: 56
Router Priority: 1
Link Local Address: FE80::C802:EFF:FE72:0
Number of Prefixes: 1
Prefix Address: 12::
Prefix Length: 64, Options: None
* Here we can see one database is advertise by Router-1 and one is advertised by Router-2
* They both are sharing the information about the link-local address and the prefix running on the segment with prefix length information
* If we have more number of IPv6 prefixes available on same segment it will include all the information
Lets add a new prefix on segment of R2 & check the database
Router-2 Configuration
interface fastEthernet 0/0
ipv6 address 21::2/64
exit
R2#show ospfv3 database Link 2
OSPFv3 1 address-family ipv6 (router-id 2.2.2.2)
Link (Type-8) Link States (Area 0)
LS age: 590
Options: (V6-Bit, E-Bit, R-bit, DC-Bit)
LS Type: Link-LSA (Interface: FastEthernet0/0)
Link State ID: 2 (Interface ID)
Advertising Router: 1.1.1.1
LS Seq Number: 80000001
Checksum: 0xEFFB
Length: 56
Router Priority: 1
Link Local Address: FE80::C801:EFF:FE6E:0
Number of Prefixes: 1
Prefix Address: 12::
Prefix Length: 64, Options: None
LS age: 6
Options: (V6-Bit, E-Bit, R-bit, DC-Bit)
LS Type: Link-LSA (Interface: FastEthernet0/0)
Link State ID: 2 (Interface ID)
Advertising Router: 2.2.2.2
LS Seq Number: 80000002
Checksum: 0xDD95
Length: 68
Router Priority: 1
Link Local Address: FE80::C802:EFF:FE72:0
Number of Prefixes: 2
Prefix Address: 12::
Prefix Length: 64, Options: None
Prefix Address: 21::
Prefix Length: 64, Options: None
Now here we can see, there are 2 subnet on the samgment and both are in the LSA-8 database
* A router can originate multiple Intra-Area Prefix LSAs for each router or transit network, each with a unique link-state ID.
* The link-state ID for each Intra-Area Prefix LSA describes its association to either the Router LSA or the Network LSA.
* The link-state ID also contains prefixes for stub and transit networks.
Lets check the database
Database on Router-2
R2#show ospfv3 database
OSPFv3 1 address-family ipv6 (router-id 2.2.2.2)
Router Link States (Area 0)...
Net Link States (Area 0)...
Link (Type-8) Link States (Area 0)...
Intra Area Prefix Link States (Area 0)
ADV Router Age Seq# Link ID Ref-lstype Ref-LSID
1.1.1.1 552 0x80000003 0 0x2001 0
1.1.1.1 17 0x80000004 2048 0x2002 2
2.2.2.2 499 0x80000003 0 0x2001 0
Now these LSA’s contains all the link information including the stub interface(loopback)
Lets check the inside view of database with Link-ID 0
Router-2 Database | LSA-9 | Inside view
R2#show ospfv3 database prefix 0
OSPFv3 1 address-family ipv6 (router-id 2.2.2.2)
Intra Area Prefix Link States (Area 0)
Routing Bit Set on this LSA
LS age: 709
LS Type: Intra-Area-Prefix-LSA
Link State ID: 0
Advertising Router: 1.1.1.1
LS Seq Number: 80000003
Checksum: 0x1C54
Length: 52
Referenced LSA Type: 2001
Referenced Link State ID: 0
Referenced Advertising Router: 1.1.1.1
Number of Prefixes: 1
Prefix Address: 1::1
?
Prefix Length: 128, Options: LA, Metric: 0
Routing Bit Set on this LSA
LS age: 656
LS Type: Intra-Area-Prefix-LSA
Link State ID: 0
Advertising Router: 2.2.2.2
LS Seq Number: 80000003
Checksum: 0x66FF
Length: 52
Referenced LSA Type: 2001
Referenced Link State ID: 0
Referenced Advertising Router: 2.2.2.2
Number of Prefixes: 1
Prefix Address: 2::2
Prefix Length: 128, Options: LA, Metric: 0
Using this Link-ID, Router is advertising the loopback address present on routers.