Community discussions

MikroTik App
 
changeip
Forum Guru
Forum Guru
Topic Author
Posts: 3830
Joined: Fri May 28, 2004 5:22 pm

OSPF Default Gateway - Routing Table Installation

Thu Feb 06, 2014 8:07 am

I would like to write a script to determine all my routers best path to the internet. Does anyone know a way to determine which LSA route gets installed on a router? Then I could tell from each router what its best path outbound is.

Image
 
CelticComms
Forum Guru
Forum Guru
Posts: 1765
Joined: Wed May 02, 2012 5:48 am

Re: OSPF Default Gateway - Routing Table Installation

Thu Feb 06, 2014 3:27 pm

This might be problematic. The LSA table doesn't contain routes as such - it contains link states, i.e. topology information. When the SPF algorithm runs it looks at the topology (link state) information and determines best routes from that. You could even have a situation where router A's SPF process determines that router B will be its upstream default route but it won't be clear from the OSPF route whether it made that choice based on an LSA from router C or D (both upstream to router B). An examination of the LSAs and the calculated cost can yield the answer but in a way one is then mimicking the SPF logic itself to make that determination.
 
changeip
Forum Guru
Forum Guru
Topic Author
Posts: 3830
Joined: Fri May 28, 2004 5:22 pm

Re: OSPF Default Gateway - Routing Table Installation

Thu Feb 06, 2014 6:05 pm

Ah, so you are saying I could query those 3 LSA entries, parse their costs and then sort them to find the lowest? That might work - will see if I can give that a shot.
 
changeip
Forum Guru
Forum Guru
Topic Author
Posts: 3830
Joined: Fri May 28, 2004 5:22 pm

Re: OSPF Default Gateway - Routing Table Installation

Thu Feb 06, 2014 6:09 pm

Doesn't work - I can't yank out the body of the LSA in script, its just blank. Any other thoughts without resorting to doing traceroutes and trying to pick out which provider it leaves?
 
CelticComms
Forum Guru
Forum Guru
Posts: 1765
Joined: Wed May 02, 2012 5:48 am

Re: OSPF Default Gateway - Routing Table Installation

Thu Feb 06, 2014 9:07 pm

It would take a bit more than looking at costs on just the LSA entries with 0.0.0.0 ids. The LSA entries give the SFP process an overview of the network topology. To arrive at routes it has to consider the costs of the various link elements which make up a possible route. In effect you would have to replicate a subset of that logic to arrive at the same decision as to which (say) default route will be entered into the routing table.

The key difference in OSPF compared to distance-vector protocols is that the remote routers are advertising their network view - i.e. their link states. They are not advertising routes as (say) RIP would. It is the SPF algorithm which generates routes from its local link state database which contains the received LSAs.

Sorry all I can offer is a confirmation that it is a tough task!

Who is online

Users browsing this forum: No registered users and 4 guests