Hi Maung,
In theory it is very easy: just configure on your central router a routing instance, then under that instance's 'protocol' stanza, both OSPF and BGP.
You will need also a policy which redistributes between those two protocols.
However, in practice you need to be extremely careful not to distribute 'too many routes' - especially into OSPF, every prefix you send will be seen as a type-5, and you really risk running out of memory very fast.
My advice is, just advertise a default and maybe your internal routes, if you have more than one way out for each branch office, or if you want to let your branch office set up their own Internet connectivity, and use the central office only as an internet-backup or to get to your intranet.
On the central office itself, then, your configuration will be something like this:
[edit routing-instances]
central_office {
routing-options {
aggregate {
route 0.0.0.0/0;
}
}
protocols {
bgp {
export export-default;
...
}
ospf {
export export-default;
...
}
}
}
[edit policy_options]
policy-statement export-default {
term 1 {
from {
prefix-list intranet-routes;
}
then accept;
}
term 2 {
from {
protocol aggregate;
route-filter 0.0.0.0/0 exact;
}
then accept;
}
term 3 {
then reject;
}
}
Term 1 may or may not be there, and there is lots of scope for optimization..I do not know how you plan to generate your intranet routes. If your addressing plan is nice and clean, adding just another aggregate will do the trick.
Still, that is the idea!
Let me know if this helps!
Saverio