This is the sixth lab in my JNCIP-ENT preparation series. Earlier labs were about switching this one moves up to OSPF. The goal is to build a topology where every regular-area LSA type shows up in one database. I had actually done this lab already and written and article about it but with only 4 routers because I thought that's the most my server could handle. In that lab I used loopback addresses to create stub links and used static routes with discard to create external routes. Apparently there is this thing called 'lite-mode' on vMX routers that makes them use less resources so I added another router and got rid of the fake stub links.
Overview
The domain has three areas and five routers:
- R1 is the ABR between Area 0 (the backbone) and Area 1. It ends up summarizing all of Area 1 into the backbone.
- R2 is the ABR between Area 0 and Area 2, and it generates the Type 4 LSA that makes R5's externals usable.
- R3 is internal to Area 1, a transit hop between R1 and R4.
- R4 is internal to Area 1. It owns two access LANs cabled to PNETLab bridges, which is what gives Area 1 a contiguous block to summarize.
- R5 is the ASBR in Area 2. It redistributes two connected edge subnets which become Type 5 external LSAs.
Topology
Step 1: Building the Domain
Configure each router's intefaces, router-ids and OSPF ares.
R1 (ABR, Area 0 and Area 1):
set interfaces ge-0/0/0 unit 0 family inet address 10.0.0.1/30set interfaces ge-0/0/1 unit 0 family inet address 10.1.0.1/30set interfaces lo0 unit 0 family inet address 10.0.255.1/32set routing-options router-id 1.1.1.1set protocols ospf area 0.0.0.0 interface ge-0/0/0.0set protocols ospf area 0.0.0.0 interface lo0.0 passiveset protocols ospf area 0.0.0.1 interface ge-0/0/1.0R2 mirrors R1 but it's in Area 2:
set interfaces ge-0/0/0 unit 0 family inet address 10.0.0.2/30set interfaces ge-0/0/1 unit 0 family inet address 10.2.0.1/30set interfaces lo0 unit 0 family inet address 10.0.255.2/32set routing-options router-id 2.2.2.2set protocols ospf area 0.0.0.0 interface ge-0/0/0.0set protocols ospf area 0.0.0.0 interface lo0.0 passiveset protocols ospf area 0.0.0.2 interface ge-0/0/1.0R3 is a transit router inside Area 1, sitting between R1 and R4:
set interfaces ge-0/0/0 unit 0 family inet address 10.1.0.2/30set interfaces ge-0/0/1 unit 0 family inet address 10.1.0.5/30set interfaces lo0 unit 0 family inet address 10.1.255.3/32set routing-options router-id 3.3.3.3set protocols ospf area 0.0.0.1 interface ge-0/0/0.0set protocols ospf area 0.0.0.1 interface ge-0/0/1.0set protocols ospf area 0.0.0.1 interface lo0.0 passiveR4 has the two access LANs in Area 1 that we will summarize later :
set interfaces ge-0/0/0 unit 0 family inet address 10.1.0.6/30set interfaces ge-0/0/1 unit 0 family inet address 10.1.10.1/24set interfaces ge-0/0/2 unit 0 family inet address 10.1.20.1/24set interfaces lo0 unit 0 family inet address 10.1.255.4/32set routing-options router-id 4.4.4.4set protocols ospf area 0.0.0.1 interface ge-0/0/0.0set protocols ospf area 0.0.0.1 interface ge-0/0/1.0 passiveset protocols ospf area 0.0.0.1 interface ge-0/0/2.0 passiveset protocols ospf area 0.0.0.1 interface lo0.0 passiveThe access LANs go into OSPF as passive. Passive means R4 advertises the subnet as an intra-area stub network but never tries to build an adjacency out those ports. These two /24s, plus the transit links and loopbacks, are the Area 1 block that R1 summarizes in Step 4.
R5 is the ASBR. It has two connected edge subnets and an export policy that redistributes them with an explicit metric:
set interfaces ge-0/0/0 unit 0 family inet address 10.2.0.2/30set interfaces ge-0/0/1 unit 0 family inet address 203.0.113.1/25set interfaces ge-0/0/2 unit 0 family inet address 203.0.113.129/25set interfaces lo0 unit 0 family inet address 10.2.255.5/32set routing-options router-id 5.5.5.5set protocols ospf area 0.0.0.2 interface ge-0/0/0.0set protocols ospf area 0.0.0.2 interface lo0.0 passiveset policy-options policy-statement redist-edge term edge from protocol directset policy-options policy-statement redist-edge term edge from route-filter 203.0.113.0/24 orlongerset policy-options policy-statement redist-edge term edge then metric 50set policy-options policy-statement redist-edge term edge then external-type 2set policy-options policy-statement redist-edge term edge then acceptset protocols ospf export redist-edgeCommit all five, then confirm every adjacency reaches Full:
show ospf neighborR1 should show two neighbors (R2 on the backbone, R3 in Area 1), R3 two (R1 and R4), R4 one (R3), R2 two (R1 and R5), R5 one (R2).
Step 2: Walk the Backbone Database
R1 holds two databases because it lives in two areas. Let's look at the backbone first:
show ospf database area 0.0.0.0Read it from the top:
- Router (Type 1) - two, one for R1 and one for R2. Scoped to the area, so neither leaves Area 0.
- Network (Type 2) - one, advertised by R2. R2 wins DR on the backbone segment since RIDs are equal-priority and 2.2.2.2 is higher; the link-state ID is R2's interface address,
10.0.0.2. Only broadcast segments produce a Type 2, which is why these ethernet links are left at their default broadcast type. - Summary (Type 3), from R1 - six, one for each Area 1 prefix crossing into the backbone:
10.1.0.0/30,10.1.0.4/30,10.1.255.3/32,10.1.255.4/32,10.1.10.0/24, and10.1.20.0/24. - Summary (Type 3), from R2 - two, for the Area 2 internal prefixes
10.2.0.0/30and10.2.255.5/32. - ASBRSum (Type 4) - advertised by R2, link-state ID
5.5.5.5. R2 generates it the moment a Type 5 crosses its area, telling the rest of the backbone how to reach the ASBR. - Extern (Type 5) - advertised by R5, one per redistributed subnet:
203.0.113.0/25and203.0.113.128/25. Domain scope, so they flood into every regular area unchanged.
R1 and R2's own loopbacks, 10.0.255.1 and 10.0.255.2, sit inside their Type 1s rather than a Type 3, since they're native to Area 0. Only prefixes crossing an area boundary become a Type 3.
Decoder bits
Let's look at one LSA of each type with extensive and read the bits. R1's own router LSA has the ABR bit:
show ospf database router lsa-id 1.1.1.1 extensivebits 0x1 is the B bit because R1 is an ABR. Run the same on R5 and you get bits 0x2, the E bit that marks the ASBR. A router that was both would read 0x3.
The external LSA shows the type-2 metric and forwarding address:
show ospf database external extensiveEach Type 5 shows Type 2, Metric 50 and a forwarding address. Type 2 means the cost stays 50 domain-wide, no matter how far you are from R5. The forwarding address of 0.0.0.0 means "send it to the advertising router," which is why the Type 4 for 5.5.5.5 has to exist. Without it, remote areas would see the external prefixes but wouldn't know how to resolve the ASBR.
Step 3: Classify the Routes
The main routing table does not label intra versus inter-area like Cisco does both are OSPF/10, and externals are OSPF/150:
show route protocol ospfOn R3 you should see the Area 0 and Area 2 internal prefixes plus the R1/R2/R5 loopbacks at [OSPF/10], and the two 203.0.113 externals at [OSPF/150] with metric 50 and a tag. The preferences are different internal at 10, external at 150.
For the Intra / Inter / External classification that a Cisco router would show on Junos you should use the OSPF-specific view:
show ospf routeIntra for R3's own area, Inter for anything learned across an ABR via Type 3, and Ext2 for R5's redistributed edge subnets via Type 5.
Connectivity
Ping across every area boundary, sourced from loopbacks so you're exercising advertised prefixes, and hit a real external target on R5:
ping 10.2.255.5 source 10.1.255.3 count 2ing 203.0.113.1 source 10.1.255.3 count 2R3 reaching 203.0.113.1 traverses Area 1, the backbone, Area 2, and lands on R5's real edge interface. This means Type 3, Type 4, and Type 5 are all doing their jobs.
Step 4: Summarize on the ABR
Right now Area 1 leaks six Type 3s into the backbone: the two transit /30s, the two /32 loopbacks, and the two access /24s. Before the change, R2 sees six separate routes:
show route 10.1.0.0/16Six inter-area routes, six contributing Type 3s.
We'll summarize on R1 because it's the ABR:
set protocols ospf area 0.0.0.1 area-range 10.1.0.0/16The six routes collapse into one on R2:
show route 10.1.0.0/16R1's backbone database also shrinks to a single Type 3 for the range:
show ospf database area 0.0.0.0Two things to keep in mind:
- The aggregate Type 3's metric equals the highest metric among the contributing routes. Here that's metric 4, matching the two access
/24s, the highest of the six contributing routes. - The six specific Area 1 routes still exist in R1's own
inet.0as intra-area routes.area-rangeonly changes what R1 advertises into the backbone. It does not touch R1's local RIB. We can confirm this withshow route 10.1.0.0/16on R1 itself and we can still see all six, plus the discard route Junos installs for the range itself.
The restrict option
Now we'll restrict the range instead of summarizing:
set protocols ospf area 0.0.0.1 area-range 10.1.0.0/16 restrictNow R1 advertises nothing for that range; on R2 the /16 disappears and Area 1 becomes unreachable from outside. This is the tool to use for hiding inter-area prefixes or forcing traffic onto a default.
We'll remove it before finishing:
delete protocols ospf area 0.0.0.1 area-range 10.1.0.0/16 restrictWhy we cant summarize externals
area-range cannot collapse the two 203.0.113 externals because area-range only acts on the Type 1/Type 2 to Type 3 conversion. Summarizing them is the ASBR's job, so we'll aggregate the routes on R5 and redistribute the aggregate instead of the components. R5 already has both /25s connected, so the aggregate stays active as a contributor:
set routing-options aggregate route 203.0.113.0/24set policy-options policy-statement redist-edge term aggr from protocol aggregateset policy-options policy-statement redist-edge term aggr from route-filter 203.0.113.0/24 exactset policy-options policy-statement redist-edge term aggr then metric 50set policy-options policy-statement redist-edge term aggr then external-type 2set policy-options policy-statement redist-edge term aggr then acceptdelete policy-options policy-statement redist-edge term edgeAfter committing on R5, the rest of the domain sees one Type 5 and one Ext2 route for 203.0.113.0/24 instead of the two /25s. Internal summarization happens at the ABR, external summarization happens at the ASBR.
