In the previous posts, we discussed about the Type-1, Type-2 and Type-3 LSAs. This article focuses on Type-4 and Type-5  LSAs. This is the fourth post in the Junos OSPF series.

Let's look at the Type-5 LSA first. Type-5 External LSAs are originated by an ASBR and flooded  by ABRs to other areas (except stub). These routes are redistributed into OSPF from other routing protocols or by the redistribution of connected or static routes.

Diagram

!vMX1
set interfaces ge-0/0/0 unit 0 family inet address 10.100.12.1/24
set interfaces ge-0/0/1 unit 0 family inet address 10.100.15.1/24
set routing-options router-id 1.1.1.1
set protocols ospf area 0.0.0.1 interface ge-0/0/0.0 interface-type p2p

!vMX2
set interfaces ge-0/0/0 unit 0 family inet address 10.100.12.2/24
set interfaces ge-0/0/1 unit 0 family inet address 10.100.23.1/24
set routing-options router-id 2.2.2.2
set protocols ospf area 0.0.0.1 interface ge-0/0/0.0 interface-type p2p
set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 interface-type p2p

!vMX3
set interfaces ge-0/0/0 unit 0 family inet address 10.100.23.2/24
set interfaces ge-0/0/1 unit 0 family inet address 10.100.34.1/24
set routing-options router-id 3.3.3.3
set protocols ospf area 0.0.0.0 interface ge-0/0/0.0 interface-type p2p
set protocols ospf area 0.0.0.2 interface ge-0/0/1.0 interface-type p2p

vMX4
set interfaces ge-0/0/0 unit 0 family inet address 10.100.34.2/24
set routing-options router-id 4.4.4.4
set protocols ospf area 0.0.0.2 interface ge-0/0/0.0 interface-type p2p

vMX5
set interfaces ge-0/0/0 unit 0 family inet address 10.100.15.2/24
set interfaces lo0 unit 0 family inet address 172.16.31.1/24
  • There are three OSPF areas
  • OPSF enabled on all the shown physical links.
  • Interface type - P2P
  • vMX5 is not running OSPF
  • vMX2 and MX3 are ABRs
  • vMX1 is ASBR since it's connecting to non-OSPF routing domain.

vMX5 is not running OSPF however, has a default route with the next-hop of vMX1.

vMX5# set routing-options static route 0.0.0.0/0 next-hop 10.100.15.1

vMX1 has a static route to reach 172.16.31.0/24 network which is directly connected to vMX5. vMX1 is then injecting this static route into OSPF domain. To represent these static routes, OSPF  creates a type 5 LSA and floods into other areas.

vMX1# set routing-options static route 172.16.31.0/24 next-hop 10.100.15.2

! Create a routing policy to redistribute static routes into OSPF
vMX1# set policy-options policy-statement static-to-ospf term static-accept from protocol static
vMX1# set policy-options policy-statement static-to-ospf term static-accept then accept

! Then apply the policy to OSPF
vMX1# set protocols ospf export static-to-ospf

Verification

Let's check whether vMX4 can reach 172.16.31.0/24 network.


root@vMX4> ping 172.16.31.1
PING 172.16.31.1 (172.16.31.1): 56 data bytes
64 bytes from 172.16.31.1: icmp_seq=0 ttl=61 time=8.623 ms
64 bytes from 172.16.31.1: icmp_seq=1 ttl=61 time=189.268 ms
64 bytes from 172.16.31.1: icmp_seq=2 ttl=61 time=308.678 ms
64 bytes from 172.16.31.1: icmp_seq=3 ttl=61 time=13.062 ms
^C
--- 172.16.31.1 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max/stddev = 8.623/129.908/308.678/126.338 ms

root@vMX4> show route 172.16.31.0/24

inet.0: 6 destinations, 6 routes (6 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

172.16.31.0/24     *[OSPF/150] 00:17:40, metric 0, tag 0
                    > to 10.100.34.1 via ge-0/0/0.0



Let's have a look at the Type-5 LSAs advertised from vMX1. The Type-5 LSA itself includes the external network (ID),  advertising router ID, subnet mask, metric type (E1/E2),  and the forwarding address.

root@vMX4> show ospf database external extensive
    OSPF AS SCOPE link state database
 Type       ID               Adv Rtr           Seq      Age  Opt  Cksum  Len
Extern   172.16.31.0      1.1.1.1          0x80000001  1090  0x22 0x7cb   36
  mask 255.255.255.0
  Topology default (ID 0)
    Type: 2, Metric: 0, Fwd addr: 0.0.0.0, Tag: 0.0.0.0
  Aging timer 00:41:50
  Installed 00:18:07 ago, expires in 00:41:50
  Last changed 00:18:07 ago, Change count: 1
  • Metric Type - The routes from external routing domain can either be E1 or E2 routes.The cost of E1 routes is the cost of the external metric plus cost to reach the ASBR. E2 routes only use the redistributed cost.Default is E2 as shown below. (Type: 2)
  • Forwarding address - The address is set to 0.0.0.0 which means ASBR is the Advertising Router and other routers in the OSPF domain should go through ASBR to reach the network

Type-4 LSA

Type-4 LSA is generated by the ABR to tell the routers in other areas how to reach the ASBR.

Well, why do we need the Type-4 LSAs in the first place? Let's look at the same output shown above from vMX4.

root@vMX4> show ospf database external extensive
    OSPF AS SCOPE link state database
 Type       ID               Adv Rtr           Seq      Age  Opt  Cksum  Len
Extern   172.16.31.0      1.1.1.1          0x80000001  1090  0x22 0x7cb   36
  mask 255.255.255.0
  Topology default (ID 0)
    Type: 2, Metric: 0, Fwd addr: 0.0.0.0, Tag: 0.0.0.0
  Aging timer 00:41:50
  Installed 00:18:07 ago, expires in 00:41:50
  Last changed 00:18:07 ago, Change count: 1
  • The advertising Router ID of the Type-5 LSA remains un-changed (1.1.1.1)
  • Forwarding address is set to 0.0.0.0 which means vMX4 should go through the ASBR (vMX1) to reach 172.16.31.0/24
  • However, vMX1 is in a different AREA, vMX4 has no knowledge of Area-1.

So, how can vMX4 reach out to the ASBR? That's where Type-4 LSA come into play. Let's check the Type-4 LSA in vMX4.

root@vMX4> show ospf database asbrsummary extensive

    OSPF database, Area 0.0.0.2
 Type       ID               Adv Rtr           Seq      Age  Opt  Cksum  Len
ASBRSum  1.1.1.1          3.3.3.3          0x80000002  1678  0x22 0x524   28
  mask 0.0.0.0
  Topology default (ID 0) -> Metric: 2
  Aging timer 00:32:02
  Installed 00:27:55 ago, expires in 00:32:02
  Last changed 01:17:51 ago, Change count: 1
  • ID - Router ID of the ASBR
  • Advertising Router is 3.3.3.3 which is an ABR
  • Mask - 0.0.0.0

In a nutshell, what the ABR/Type-4 LSA saying is "to reach the ASBR (1.1.1.1), please go through me (3.3.3.3)"


You can also see the packet capture  where vMX3 sends Type-4 & Type-5 LSAs via DB Description packets to vMX3.

Thanks for reading

As always, your feedback and comments are more than welcome.