We will be using two Internet connections, a primary and a secondary. Each connection will have a router with a BGP session to the ISP, who will announce a default route.
I understand that the "default information-originate" will add a default route into OSPF if I receive a default though BGP but is there a preferred way to add a metric so that the primary link is preferred?
having two ASBR routers advertising 0.0.0.0/0, the best choice is to use OSPF E1 type of route that takes in account the cost to reach the ASBR and the seed metric.
you can deploy an iBGP session between them as suggested by Rick.
OSPF default information-originate allows to invoke a route-map.
The route-map can check the following conditions:
the presence of 0.0.0.0/0 net in BGP table;
the BGP next-hop of the 0.0.0.0/0 route (very important to discriminate what router should advertise the default route in the OSPF domain)
based on these conditions the route-map can set some attributes of the generated OSPF default route:
metric-type 1 (O E1)
metric 50 (seed metric )
We have used this schema years ago for internet access with the two ASBR nodes in two different POPs in two different towns with good success.
config example can be:
ip prefix-list only-default permit 0.0.0.0/0
access-list 11 permit host ISP-eBGP-neigh-ip-addr
route-map check_bgp permit 10
match ip address prefix only-default
match ip next-hop 11
set metric-type 1
set metric 50
router ospf 10
default-information originate route-map check_bgp
on the second router you should use a greater seed metric taking in account the different internal OSPF path costs:
if you want it to be used only when primary ISP fails you can use a seed metric of 500 or more.
Hope to help