Series Announcement: OSPF Database on Junos

Since I started my journey into Junos studies recently, I am curios to translate my IOS skills into the new environment. One of my strong networking areas is a fairly deep understanding of OSPF and its implementation in IOS. In the next few articles, I will try to explore the same aspects in Junos.

OSPF Database in Cisco IOS

Before I continue for those of you who are more interested in IOS I wrote a similar set of articles for IPexpert’s CCIE blog back in 2010. Here are the links to those articles:

Test Bed and Initial Configuration

I always prefer a hands-on approach to exploring practical things. This will be no exception.

The testbed network I’ll work with is shown on the diagram below. I think it will be more than flexible to show me everything I need to know about the OSPF database, as Junos sees it.

Junos OSPF Diagram

These are the initial configurations. I will set OSPF router IDs manually to deliberately make them different from routers’ loopback interfaces. Sometimes this approach makes things a bit clearer for explanations. You should probably avoid this approach in production environments.

R1:

interfaces {                            
    em2 {
        unit 0 {
            family inet {
                address 192.168.13.1/24;
            }
        }
    }
    em3 {
        unit 0 {
            family inet {
                address 192.168.14.1/24;
            }
        }
    }
    lo0 {
        unit 0 {
            family inet {
                address 192.168.0.1/32;
            }
        }
    }
}
routing-options {
    router-id 1.1.1.1;
}
protocols {
    ospf {
        area 0.0.0.0 {
            interface lo0.0 {           
                passive;
            }
            interface em2.0;
        }
        area 0.0.0.14 {
            interface em3.0 {
                interface-type p2p;
            }
        }
    }
}

R2:

interfaces {                            
    em2 {
        unit 0 {
            family inet {
                address 192.168.23.2/24;
            }
        }
    }
    lo0 {
        unit 0 {
            family inet {
                address 192.168.0.2/32;
            }
        }
    }
}
routing-options {
    router-id 2.2.2.2;
}
protocols {
    ospf {
        area 0.0.0.23 {
            interface lo0.0 {
                passive;
            }
            interface em2.0 {
                interface-type p2p;
            }
        }
    }                                   
}

R3:

interfaces {                            
    em0 {
        unit 0 {
            family inet {
                address 192.168.23.3/24;
            }
        }
    }
    em2 {
        unit 0 {
            family inet {
                address 192.168.13.3/24;
            }
        }
    }
    lo0 {
        unit 0 {
            family inet {
                address 192.168.0.3/32;
            }
        }
    }
}
routing-options {
    router-id 3.3.3.3;
}
protocols {
    ospf {
        area 0.0.0.0 {
            interface lo0.0 {           
                passive;
            }
            interface em2.0;
        }
        area 0.0.0.23 {
            interface em0.0 {
                interface-type p2p;
            }
        }
    }
}

R4:

interfaces {                            
    em3 {
        unit 0 {
            family inet {
                address 192.168.14.4/24;
            }
        }
    }
    lo0 {
        unit 0 {
            family inet {
                address 192.168.0.4/32;
            }
        }
    }
}
routing-options {
    static {
        route 10.0.0.0/24 discard;
    }
    router-id 4.4.4.4;
}
protocols {
    ospf {
        export INJECT;
        area 0.0.0.14 {
            interface lo0.0 {
                passive;
            }
            interface em3.0 {           
                interface-type p2p;
            }
        }
    }
}
policy-options {
    policy-statement INJECT {
        from protocol static;
        then accept;
    }
}

At this moment, I should see OSPF neighbors and OSPF routes for all the interfaces and the exported static route from R4. Let’s see if that’s the case.

R1:

markom@R1> show route protocol ospf terse

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

A Destination        P Prf   Metric 1   Metric 2  Next hop        AS path
* 10.0.0.0/24        O 150          0            >192.168.14.4
* 192.168.0.2/32     O  10          2            >192.168.13.3
* 192.168.0.3/32     O  10          1            >192.168.13.3
* 192.168.0.4/32     O  10          1            >192.168.14.4
* 192.168.23.0/24    O  10          2            >192.168.13.3
* 224.0.0.5/32       O  10          1             MultiRecv

markom@R1> show ospf neighbor
Address          Interface              State     ID               Pri  Dead
192.168.13.3     em2.0                  Full      3.3.3.3          128    38
192.168.14.4     em3.0                  Full      4.4.4.4          128    36

R2:

markom@R2> show route protocol ospf terse

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

A Destination        P Prf   Metric 1   Metric 2  Next hop        AS path
* 10.0.0.0/24        O 150          0            >192.168.23.3
* 192.168.0.1/32     O  10          2            >192.168.23.3
* 192.168.0.3/32     O  10          1            >192.168.23.3
* 192.168.0.4/32     O  10          3            >192.168.23.3
* 192.168.13.0/24    O  10          2            >192.168.23.3
* 192.168.14.0/24    O  10          3            >192.168.23.3
* 224.0.0.5/32       O  10          1             MultiRecv

markom@R2> show ospf neighbor
Address          Interface              State     ID               Pri  Dead
192.168.23.3     em2.0                  Full      3.3.3.3          128    38

R3:

markom@R3> show route protocol ospf terse

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

A Destination        P Prf   Metric 1   Metric 2  Next hop        AS path
* 10.0.0.0/24        O 150          0            >192.168.13.1
* 192.168.0.1/32     O  10          1            >192.168.13.1
* 192.168.0.2/32     O  10          1            >192.168.23.2
* 192.168.0.4/32     O  10          2            >192.168.13.1
* 192.168.14.0/24    O  10          2            >192.168.13.1
* 224.0.0.5/32       O  10          1             MultiRecv

markom@R3> show ospf neighbor
Address          Interface              State     ID               Pri  Dead
192.168.13.1     em2.0                  Full      1.1.1.1          128    35
192.168.23.2     em0.0                  Full      2.2.2.2          128    35

R4:

markom@R4> show route protocol ospf terse

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

A Destination        P Prf   Metric 1   Metric 2  Next hop        AS path
* 192.168.0.1/32     O  10          1            >192.168.14.1
* 192.168.0.2/32     O  10          3            >192.168.14.1
* 192.168.0.3/32     O  10          2            >192.168.14.1
* 192.168.13.0/24    O  10          2            >192.168.14.1
* 192.168.23.0/24    O  10          3            >192.168.14.1
* 224.0.0.5/32       O  10          1             MultiRecv

markom@R4> show ospf neighbor
Address          Interface              State     ID               Pri  Dead
192.168.14.1     em3.0                  Full      1.1.1.1          128    37

My initial setup is ready, I have a flexible test-bed with multiple areas and an external network. This should be loads of fun to explore.

Basic OSPF Database Tools

It pains me to admit this in the first sentence, but Junos’ OSPF database tools are much more complete than those in IOS. Let’s take a few basic steps before we dive deeper.

R4:

markom@R4> show ospf database ?
Possible completions:
  <[Enter]>            Execute this command
  advertising-router   Router ID of advertising router
  area                 OSPF area ID
  asbrsummary          Summary AS boundary router link-state advertisements
  brief                Display brief output (default)
  detail               Display detailed output
  extensive            Display extensive output
  external             External link-state advertisements
  instance             Name of OSPF instance
  link-local           Link local link-state advertisements
  logical-system       Name of logical system, or 'all'
  lsa-id               Link-state advertisement ID
  netsummary           Summary network link-state advertisements
  network              Network link-state advertisements
  nssa                 Not-so-stubby area link-state advertisements
  opaque-area          Opaque area-scope link-state advertisements
  router               Router link-state advertisements
  summary              Display summary output
  |                    Pipe through a command

At first glance, this looks very similar to the output of “show ip ospf database” in IOS, however one thing sticks out. In Junos, we can actually explore individual area databases independently. Doing the same in IOS, is a little bit awkward.

Among other available options are classic Junos options, such as “detail” and “extensive” that show progressively more information about the contents of the database.

Simply running the command, without any options will yield a terse, yet very useful output.

R4:

markom@R4> show ospf database

    OSPF database, Area 0.0.0.14
 Type       ID               Adv Rtr           Seq      Age  Opt  Cksum  Len 
Router   1.1.1.1          1.1.1.1          0x8000002a  2012  0x22 0x7696  36
Router  *4.4.4.4          4.4.4.4          0x80000030   368  0x22 0xf577  48
Network *192.168.14.4     4.4.4.4          0x80000028  1368  0x22 0x1f54  32
Summary  192.168.0.1      1.1.1.1          0x8000002a   530  0x22 0x5d48  28
    OSPF AS SCOPE link state database
 Type       ID               Adv Rtr           Seq      Age  Opt  Cksum  Len 
Extern  *10.0.0.0         4.4.4.4          0x80000028  2368  0x22 0xb7b9  36

We can clearly see LSA types and IDs in the first and second columns, advertising router in the 3rd, as well as other, somewhat less relevant parameters at the end. Very useful for OSPF studies is a reminder that external LSAs have AS scope. Very nice touch is the asterisk (*), which indicates self-originated LSAs.

Another useful output is produced using “summary” keyword. This will show us a very brief statistical information about the data in the database.

R1:

markom@R1> show ospf database summary
Area 0.0.0.0:
   1 Router LSAs
   2 Summary LSAs
   1 ASBRSum LSAs
Area 0.0.0.14:
   2 Router LSAs
   1 Network LSAs
   1 Summary LSAs
Externals:
   1 Extern LSAs
Interface em2.0:
Area 0.0.0.0:
Interface em3.0:
Area 0.0.0.14:
Interface lo0.0:
Area 0.0.0.0:

Quick Comparison to IOS

I really didn’t want this article to turn into Junos and IOS comparison, but I keep being drawn to it. So, here’s a quick comparison of some of the more important OSPF database lookup commands between the two.

IOS Junos Purpose
show ip ospf database show ospf database Database lookup command. With no parameters, shows the summarized database information.
database-summary summary Display OSPF database statistics.
adv-router RID advertising-router RID Display all LSAs originated by the router with the OSPF router-id RID.
self-originate N/A Display all LSAs originated by the local router.
N/A area A.A.A.A Display LSA database for area A.A.A.A
router router Display Type-1 (Router) LSAs.
network network Display Type-2 (Network) LSAs.
summary netsummary Display Type-3 (Summary) LSAs.
asbr-summary asbrsummary Display Type-4 (ASBR-Summary) LSAs.
external external Display Type-5 LSAs.
nssa-external nssa Display Type-7 LSAs.

Next time, I’ll take a deeper look into Router LSA and how we can dig that information out.

She’s very supportive of my Junos studies. The only problem is… I’m not sure how much time I can dedicate to it. I have so many fun projects coming up!

  1. self-originate = advertising-router self.

    It seems to be a recent command available in Junos 12.x but not as late as 9.x

    Nic

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>