Ok..so same topology as for RIP. For interface configurations check : [[ Juniper RIP Howto ]]
Configuration

R1:
set protocols ospf area 0.0.0.0 interface fxp1.0
R2:
set protocols ospf area 0.0.0.0 interface fxp1.0
set protocols ospf area 0.0.0.0 interface fxp2.0
R3:
set protocols ospf area 0.0.0.0 interface fxp2.0
set protocols ospf area 0.0.0.0 interface fxp1.0
set protocols ospf area 0.0.0.0 interface fxp1.2
R4:
set protocols ospf area 0.0.0.0 interface fxp1.0
set protocols ospf area 0.0.0.0 interface fxp1.2
Debug
[root@box ~]# jlogin -c "show route" 10.0.1.1
spawn ssh -c 3des -x -l rancid 10.0.1.1
rancid@10.0.1.1's password:
--- JUNOS 8.5R3.4 built 2008-04-24 03:40:14 UTC
rancid@br0>
rancid@br0> set cli complete-on-space off
Disabling complete-on-space
rancid@br0> set cli screen-length 0
Screen length set to 0
rancid@br0> show route
inet.0: 11 destinations, 11 routes (10 active, 0 holddown, 1 hidden)
+ = Active Route, - = Last Active, * = Both
0.0.0.0/0 *[Static/5] 00:26:09
> to 10.0.1.254 via fxp0.0
10.0.1.0/24 *[Direct/0] 00:26:10
> via fxp0.0
10.0.1.1/32 *[Local/0] 00:26:10
Local via fxp0.0
172.16.9.1/32 *[Direct/0] 00:26:10
> via lo0.0
192.168.5.0/30 *[Direct/0] 00:26:10
> via fxp1.0
192.168.5.1/32 *[Local/0] 00:26:10
Local via fxp1.0
192.168.6.0/30 *[OSPF/10] 00:12:51, metric 20 // routes from R3
> to 192.168.5.2 via fxp1.0
192.168.7.0/29 *[OSPF/10] 00:12:39, metric 30 // routes from R4
> to 192.168.5.2 via fxp1.0
192.168.8.0/29 *[OSPF/10] 00:12:39, metric 30 // routes from R4
> to 192.168.5.2 via fxp1.0
224.0.0.5/32 *[OSPF/10] 00:26:12, metric 1
MultiRecv
rancid@br0> quit
Connection to 10.0.1.1 closed.
As you can see R1 get the routes from R3 and R4. Also ping should work between this 4 routers.
[root@box ~]# jlogin -c "ping rapid 192.168.7.2" 10.0.1.1
spawn ssh -c 3des -x -l rancid 10.0.1.1
rancid@10.0.1.1's password:
--- JUNOS 8.5R3.4 built 2008-04-24 03:40:14 UTC
rancid@br0>
rancid@br0> set cli complete-on-space off
Disabling complete-on-space
rancid@br0> set cli screen-length 0
Screen length set to 0
rancid@br0> ping rapid 192.168.7.2
PING 192.168.7.2 (192.168.7.2): 56 data bytes
!!!!!
--- 192.168.7.2 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max/stddev = 8.507/13.222/21.780/5.199 ms
rancid@br0> quit
Connection to 10.0.1.1 closed.
View ospf database:
rancid@br0> show ospf database
OSPF link state database, Area 0.0.0.0
Type ID Adv Rtr Seq Age Opt Cksum Len
Router *172.16.9.1 172.16.9.1 0x80000004 982 0x22 0xfa8 36
Router 172.16.9.2 172.16.9.2 0x80000008 971 0x22 0x783f 48
Router 172.16.9.3 172.16.9.3 0x80000009 972 0x22 0x872c 60
Router 172.16.9.4 172.16.9.4 0x80000004 976 0x22 0xe2cd 48
Network 192.168.5.2 172.16.9.2 0x80000001 983 0x22 0x175 32
Network 192.168.6.2 172.16.9.3 0x80000001 972 0x22 0x86a 32
Network 192.168.7.1 172.16.9.3 0x80000002 137 0x22 0x96a 32
Network 192.168.8.1 172.16.9.3 0x80000002 437 0x22 0xfd74 32
redistribute routes
Lets say we set on R1 a default route:
set routing-options static route 0.0.0.0/0 next-hop 10.0.1.254
And now you want to send a default route to the rest of the routers. First we need to create a policy statement
from protocol static. Of course you can match specific routes. Check [[ Redistribute routes ]] for details.
set policy-options policy-statement default-route term 1 from protocol static
set policy-options policy-statement default-route term 1 then accept
and then we export that statement into OSPF:
set protocols ospf export default-route
Routing table on R2 will look like:
rancid@R2> show route
0.0.0.0/0 *[OSPF/150] 00:25:16, metric 0, tag 0
> to 192.168.5.1 via fxp1.0
As you can see it recieves 0.0.0.0/0 via OSPF.