Configuring OSPF on Juniper MX

For example, I will configure OSPF on Juniper MX204.

Let’s see the installed licenses:

show system license

Be sure to specify the router-id:

set routing-options router-id 192.168.5.5

Let’s specify the local interface in passive mode so as not to establish a neighborhood on this interface, but to declare routes from it:

set protocols ospf area 0.0.0.0 interface lo0.0 passive

Let’s configure OSPF on the interface towards neighbors:

set protocols ospf area 0.0.0.0 interface ae0.500 hello-interval 2 dead-interval 8

I also specified a password for authentication:

set protocols ospf area 0.0.0.0 interface ae0.500 authentication md5 5 key ixnfo.com

hello-interval and dead-interval must match those specified by neighbors, mtu on the interface must also match.

If the neighbor is also BIRD, then the password in its configuration can be specified as follows:

authentication cryptographic; password "ixnfo.com" {id 5;};

Here are the neighbors:

set protocols ospf area 0.0.0.0 interface ae0.500 neighbor 192.168.5.5

If you need to set the neighbor on all interfaces, you can specify it like this:

set protocols ospf area 0.0.0.0 interface all
set protocols ospf area 0.0.0.0 interface fxp0.0 disable

Let’s look at the configuration and apply:

show protocols ospf
show routing-options
show configuration protocols ospf | display set
commit check
commit

Let’s exit the configuration mode and see the routes received from other OSPF neighbors, as well as other statistics:

exit
show route protocol ospf
show ospf neighbor
show ospf neighbor detail
show ospf database
show ospf route
show ospf statistic
show ospf interface
show ospf log

In case of problems, you can temporarily enable ospf debug logs (I don’t recommend leaving it enabled, it will write a lot of data to Juniper’s internal memory, which may eventually fail):

set protocols ospf traceoptions file debug_ospf files 2
set protocols ospf traceoptions flag hello send receive detail
set protocols ospf traceoptions flag error detail
commit
run show log debug_ospf | last 30
delete protocols ospf traceoptions
commit

You can also see the traffic on the interface (tcpdump):

run monitor traffic interface ae0.500 no-resolve detail

OSPF messages are sent immediately to all neighbors by broadcast traffic, unless of course they are on the same network, this is convenient, since you do not need to duplicate them over unicast for each neighbor.

See also my articles:
Juniper MX204 setup
My other articles about Juniper
Configuring OSPF in BIRD

Leave a comment

Leave a Reply