How to setup OSPF in Juniper:
edit
set interfaces ge-0/0/1.0 family inet address 13.13.13.1/24
set interfaces lo.0.0 family inet address 1.1.1.1/24
set interfaces lo.0.0 family inet address 11.11.11.11/24
commit and-quit
Test lo.0.0 interface's reachability:
ping 13.13.13.1
Setup Area 0 (backbone):
edit protocols ospf
set area 0.0.0.0 (or just 0) interface ge-0/0/1.0
set area 0 interface ge-lo0.0
commit and-quit
Setup up trace on R1:
edit protocols ospf
set traceoptions file OSPFLAB1 size 1000000
set traceoptions flag all
commit and-quit
show log OSPFLAB1
show ospf neighbor
show log OSPFLAB1 | match HELLO
OSPF must be set up on both neighbors with matching
Connect to R3:
set area 0 interface ge-0/0/1.0
set area 0 interface lo0.0
show configuration protocols ospf //check config
show ospf neighbor //check ospf status
Connect to R1:
show ospf neighbor
show log OSPFLAB1 | match OSPF | match neighbor //match only OSPF and neighbor
show log OSPFLAB1 | match DR //filter result to show only DR / BDR information
show ospf neighbor detail //display DR & BDR and interfaces information
Note: OSPF elects router with the highest IP address (ID) to be DR
connect to R3
edit routing-options
set router-id 200.200.200.200
commit and-quit
Force re-election:
set interfaces ge-0/0/1 disable
delete interfaces ge-0/0/1 disable
show ospf neighbor detail //display DR / BDR info
show configuration protocols ospf //display area ID and interfaces involved
show route protocols ospf //display all learned routes from OSPF
ping 1.1.1.1 source 3.3.3.3 //test pingability from R3 loopback interface to R1
show ospf overview //show areas, stub type, authentication, neighbors
---------------------------------------------------
Connect to R1
edit
set logical-systems R1 interfaces lt-1/2/0 unit 12 family inet 12.12.12.1/24
set logical-systems R1 interfaces lt-1/2/0 unit 12 family peer-unit 21 //connecting to R2
set logical-systems R1 interfaces lt-1/2/0 unit 12 family encapsulation ethernet
set logical-systems R1 interfaces lo0 unit 1 family inet 1.1.1.1/24
set logical-systems R1 interfaces lo0 unit 1 family
set logical-systems R1 interfaces lo0 unit 1 family
commit
Connect to R2
set logical-systems R2 interfaces lt-1/2/0 unit 21 family inet 12.12.12.2/24
set logical-systems R2 interfaces lt-1/2/0 unit 21 family peer-unit 12 //connecting to R1
set logical-systems R2 interfaces lt-1/2/0 unit 21 family encapsulation ethernet
set logical-systems R2 interfaces lt-1/2/0 unit 23 family inet 23.23.23.2/24
set logical-systems R2 interfaces lt-1/2/0 unit 23 family peer-unit 32 //connecting to R3
set logical-systems R2 interfaces lt-1/2/0 unit 23 family encapsulation ethernet
Connect to R3
set logical-systems R3 interfaces lt-1/2/0 unit 32 family inet 23.23.23.3/24
set logical-systems R3 interfaces lt-1/2/0 unit 32 family peer-unit 23 //connecting to R1
set logical-systems R3 interfaces lt-1/2/0 unit 32 family encapsulation ethernet
set logical-systems R3 interfaces lo0.3 family inet address 3.3.3.3/24
commit
Note: it's very important to set the loopback interfaces as those are being used by OSPF to propate routes between disparate areas
Connect to R2 to verify connectivity
set cli logical-system R2
show route
ping 12.12.12.1 //R1
ping 23.23.23.3 //R3
Setup OSPF link between R1 and R2
Connect to R1
edit protocols ospf
set area 0 interface lt-1/2/0.12
set area 0 interface lo0.1
top
show
commit and-quit
set cli logical-system R2
edit
edit protocols ospf
set area 0 interface lt-1/2/0.21
set area 23 interface lt-1/2/0.23
commit and-quit
show ospf neighbor detail
set cli logical-system R3
edit protocols ospf
set area 23 interface lt-1/2/0.32
set area 23 interface lo0.3
commit and-save
show configuration protocols ospf
show ospf neighbor detail //check ospf neighbors (DR / BDR)
show route //check routes learned from ospf
ping 1.1.1.1 source 3.3.3.3 //check pingability from R3 to R1
Connect to R2 to check ospf
show ospf overview //show areas, DR, BDR
show ospf database //display link states of ospf and database
Categories: