In my previous Junos Basics post I covered a simple VRRP configuration in Junos. In this post I’ll run through a basic OSPF configuration on a pair of Juniper routers.
Here’s our network:
Objectives:
- Establish an OSPF neighbour relationship between R1 and R2
- increase security by using md5 authentication
- Configure all router interfaces to be part of OSPF area 0.0.0.0
- Make interaces e1 and e2 passive for OSPF on each router
First of all, we’ll put the IP addresses onto each interface. Here’s R1’s config:
set interfaces em0 unit 0 family inet address 192.168.0.1/30 set interfaces em1 unit 0 family inet address 10.0.0.1/24 set interfaces em2 unit 0 family inet address 10.0.1.1/24
Here’s R2’s interface configuration and confirmation of IP connectivity to R1:
set interfaces em0 unit 0 family inet address 192.168.0.2/30 set interfaces em1 unit 0 family inet address 10.0.2.1/24 set interfaces em2 unit 0 family inet address 10.0.3.1/24 root> ping 192.168.0.1 PING 192.168.0.1 (192.168.0.1): 56 data bytes 64 bytes from 192.168.0.1: icmp_seq=0 ttl=64 time=0.206 ms 64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=0.405 ms
Next, we configure interface em0 on each router to be in OSPF area 0.0.0.0 and to use md5 authentication with a key of “juniper”:
[edit protocols ospf] root# set area 0.0.0.0 interface em0 authentication md5 1 key juniper
Verify we now have a neighbour relationship formed between R1 and R2:
root@R1> show ospf neighbor Address Interface State ID Pri Dead 192.168.0.2 em0.0 Full 10.0.2.1 128 37 root@R2> show ospf neighbor Address Interface State ID Pri Dead 192.168.0.1 em0.0 Full 10.0.0.1 128 30
Next, we’ll configure the other interfaces on each router so that the networks they are attached to are advertised into OSPF area 0.0.0.0, but no neighbour relationships can form over them (passive):
set protocols ospf area 0.0.0.0 interface em1 passive set protocols ospf area 0.0.0.0 interface em2 passive
If we verify the OSPF interface configuration on R2, we can also see that R2 has won the election process to become the Designated Router (DR) for area 0.0.0.0:
root@R2> show ospf interface Interface State Area DR ID BDR ID Nbrs em0.0 DR 0.0.0.0 10.0.2.1 10.0.0.1 1 em1.0 DRother 0.0.0.0 0.0.0.0 0.0.0.0 0 em2.0 DRother 0.0.0.0 0.0.0.0 0.0.0.0 0
Next, we’ll take a look at R2’s OSPF routing table and check it contains routes to R1’s attached networks:
root@R2> show ospf route Topology default Route Table: Prefix Path Route NH Metric NextHop Nexthop Type Type Type Interface addr/label 10.0.0.1 Intra Router IP 1 em0.0 192.168.0.1 10.0.0.0/24 Intra Network IP 2 em0.0 192.168.0.1 10.0.1.0/24 Intra Network IP 2 em0.0 192.168.0.1 10.0.2.0/24 Intra Network IP 1 em1.0 10.0.3.0/24 Intra Network IP 1 em2.0 192.168.0.0/30 Intra Network IP 1 em0.0
One other useful verification command displays the OSPF Link State Database:
root@R2> show ospf database OSPF database, Area 0.0.0.0 Type ID Adv Rtr Seq Age Opt Cksum Len Router 10.0.0.1 10.0.0.1 0x8000000b 332 0x22 0x2adb 60 Router *10.0.2.1 10.0.2.1 0x8000000a 325 0x22 0x827b 60 Network *192.168.0.2 10.0.2.1 0x80000003 2514 0x22 0x3476 32
I hope this has been a useful explanation. In my next Junos Basics post I’ll cover configuring an EX2200C switch as a DHCP server.
Thanks for reading.
Rich
Follow Rich on Twitter
Hi Rich,
Hope you are doing well there, you have started a very nice series of basic “configuration on JUNOS”, I thought it will be very useful for many aspirants, I Like it and wanna say that please continue with what you are posting here.
Thanks & regards,
Afsar
Thanks for the comments Afsar. I really appreciate them and I’m glad you like the posts! I’m enjoying writing them!
Rich