Hello Mike,

There is no concept of latency by peer in any main stream routing protocol because latency can be influenced by traffic load, which would create a real mess trying to understand the traffic flow. If you know one link is always lower latency than the next you simply set the cost manually at startup. 

Cisco’s EIGRP protocol does have a load concept, but I believe Cisco pretty much says don’t use it (;

If you really wanted to you could create a script that ran a manual test of the latency of each link, the script could then updated the cost value in bird and reconfigure it though.

Cheers,
Mike

--
Michael McConnell
WINK Streaming;
email: michael@winkstreaming.com
phone: +1 312 281-5433 x 7400
cell: +506 8706-2389
skype: wink-michael
web: http://winkstreaming.com

On Dec 21, 2016, at 12:52 PM, Mike Jones <mike@mikejones.in> wrote:

Hi,

I have an OSPF based network using bird for routing the core and it
seems to work fine, however the network is geographically diverse and
some of the routing is sub-optimal. Specifically, the default route is
going shortest hops rather than lowest latency.

What I would like to do is have the OSPF cost reflect the latency of
the link, however I am having a problem coming up with a
scalable/automated way of doing this. As far as I can tell there is no
built in "latency to peer" I can reference? I could configure a manual
entry for each peer in the config file, however that doesn't seem very
manageable, even with some kind of script to generate the config file.

From what I can gather there is no way for a filter to reference an
external file/database/script to adjust the routes on import. I even
considered a convoluted approach of having a script inject the peers
IP address in to a special kernel table and using the route metric to
feed numbers in to bird, but couldn't find a way of storing the data
and referencing it on a later route lookup.

Basically what I want is that when an OSPF peer comes up I ping it
then set the cost for all routes received from that neighbour to the
latency (with some basic sanity like a min and max). I don't expect
the latency to vary much once a link is up, however I do need to
auto-discover new peers appearing on the network.

Any ideas?

Thanks
- Mike Jones