Community discussions

MUM Europe 2020
 
Dmitri
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 51
Joined: Tue Feb 25, 2014 11:54 am

OSPF and default route switching

Mon Mar 02, 2015 1:50 pm

Hello folks.

Assume I have a simple topology

Router1 <-> Router 2 <-> Router 3

Router 1 should ALWAYS be a default gw for R2 and R3.
But when R1 goes down or can't ping it's own gw R2 should become a default gw for itself and R3 (and R1 if it's online but can't ping gw).

After R1 restores it's state I want system to switch back to it.

Can you please advise me a working configuration for that ?

Thanx and BRGDS
D.
 
User avatar
rwrocket
Frequent Visitor
Frequent Visitor
Posts: 80
Joined: Mon Nov 24, 2014 8:08 am

Re: OSPF and default route switching

Wed Mar 04, 2015 2:52 am

You haven't given very detailed information but as I understand it you should be able to do it by setting a static default route on R2 with a distance of 180 or something that will not take precedence over the default route coming from OSPF.

You may need to adjust your OSPF instance on R2, by that I mean adjust the value for distribute default route.

Experiment with that I think it should work.
 
Dmitri
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 51
Joined: Tue Feb 25, 2014 11:54 am

Re: OSPF and default route switching

Wed Mar 04, 2015 11:44 am

Here comes details
1. Network diagram
Image

2. R1 configuration
/interface ethernet
set [ find default-name=ether1 ] name=ether1-OUT1
set [ find default-name=ether2 ] name=ether2-R2

/routing ospf instance
set [ find default=yes ] distribute-default=if-installed-as-type-1 name=R1 \
    redistribute-connected=as-type-1 router-id=255.255.255.255

/ip address
add address=192.168.0.2/24 interface=ether1-OUT1 network=192.168.0.0
add address=10.255.0.6/30 interface=ether2-R2 network=10.255.0.4
add address=192.168.90.1/24 interface=ether4 network=192.168.90.0
/ip route
add distance=1 gateway=192.168.0.1

/routing ospf network
add area=backbone network=10.255.0.4/30

/system identity
set name=R1

3. R2 configuration
/interface ethernet
set [ find default-name=ether5 ] name=ether5-OUT2
set [ find default-name=ether6 ] name=ether6-R1
set [ find default-name=ether7 ] name=ether7-R3

/routing ospf area
set [ find default=yes ] name=R2
/routing ospf instance
set [ find default=yes ] distribute-default=if-installed-as-type-1 \
    metric-default=100  name=R2 redistribute-connected=\
    as-type-1

/ip address
add address=192.168.88.1/24 interface=ether8 network=192.168.88.0
add address=10.255.0.1/30 interface=ether7-R3 network=10.255.0.0
add address=10.255.0.5/30 interface=ether6-R1 network=10.255.0.4
add address=192.168.1.23/24 interface=ether5-OUT2 network=192.168.1.0
/ip route
add check-gateway=ping distance=200 gateway=192.168.1.1

/routing ospf network
add area=R2 network=10.255.0.0/30
add area=R2 network=10.255.0.4/30


/system identity
set name=R2
4. Simple R3
/interface ethernet
set [ find default-name=ether4 ] name=ether4-R2

/routing ospf instance
set [ find default=yes ] name=R3 redistribute-connected=as-type-1

/ip address
add address=192.168.89.1/24 interface=ether2 network=192.168.89.0
add address=10.255.0.2/30 interface=ether4-R2 network=10.255.0.0

/routing ospf network
add area=backbone network=10.255.0.0/30
/system identity
set name=R3
But on R2 we see
[admin@R2] > routing ospf neighbor pr
 0 instance=R2 router-id=10.255.0.2 address=10.255.0.2 interface=ether7-R3 
   priority=1 dr-address=10.255.0.2 backup-dr-address=10.255.0.1 state="Full" 
   state-changes=5 ls-retransmits=0 ls-requests=0 db-summaries=0 
   adjacency=13m49s 

 1 instance=R2 router-id=255.255.255.255 address=10.255.0.6 interface=ether6-R1 
   priority=1 dr-address=10.255.0.6 backup-dr-address=10.255.0.5 state="Full" 
   state-changes=6 ls-retransmits=0 ls-requests=0 db-summaries=0 
   adjacency=13m54s 
[admin@R2] > 
But R2 uses it's own default gw!
[admin@R2] > ip rou pr
Flags: X - disabled, A - active, D - dynamic, 
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme, 
B - blackhole, U - unreachable, P - prohibit 
 #      DST-ADDRESS        PREF-SRC        GATEWAY            DISTANCE
 0 A S  0.0.0.0/0                          192.168.1.1             200
 1 ADC  10.255.0.0/30      10.255.0.1      ether7-R3                 0
 2 ADC  10.255.0.4/30      10.255.0.5      ether6-R1                 0
 3 ADo  192.168.0.0/24                     10.255.0.6              110
 4 ADC  192.168.1.0/24     192.168.1.23    ether5-OUT2               0
 5  DC  192.168.88.0/24    192.168.88.1    ether8                  255
[admin@R2] > 
Just for info
[admin@R2] > routing ospf route pr
 # DST-ADDRESS        STATE          COST         GATEWAY         INTERFACE    
 0 0.0.0.0/0          imported-ext-1 100         
 1 10.255.0.0/30      intra-area     10           0.0.0.0         ether7-R3    
 2 10.255.0.4/30      intra-area     10           0.0.0.0         ether6-R1    
 3 192.168.0.0/24     ext-1          30           10.255.0.6      ether6-R1    
 4 192.168.1.0/24     imported-ext-1 100         
[admin@R2] > 
 
User avatar
ZeroByte
Forum Guru
Forum Guru
Posts: 4051
Joined: Wed May 11, 2011 6:08 pm

Re: OSPF and default route switching

Thu Mar 05, 2015 12:07 pm

But R2 uses it's own default gw!
That's pretty strange. I saw a post from you in a different thread about this same topic, but you stated that you need to disable/enable the floating static backup default gateway. Did that fix this issue?

That sounds like a bug to me - your output shows something that (in my opinion) clearly shows that the router should be using the OSPF default route and not the static route.
When given a spoon,
you should not cling to your fork.
The soup will get cold.
 
Dmitri
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 51
Joined: Tue Feb 25, 2014 11:54 am

Re: OSPF and default route switching

Thu Mar 05, 2015 12:19 pm

But R2 uses it's own default gw!
That's pretty strange. I saw a post from you in a different thread about this same topic, but you stated that you need to disable/enable the floating static backup default gateway. Did that fix this issue?

That sounds like a bug to me - your output shows something that (in my opinion) clearly shows that the router should be using the OSPF default route and not the static route.
Interesting that much more people took a look at the second thread - the magic of words I think :)

Yes, if static route 0.0.0.0/0 is manually disabled and then enabled while ospf is running R2 took a correct gw. I never wrote scripts for mikrotik so it's really a poor solution.

Where should I report a bug ?
 
User avatar
ZeroByte
Forum Guru
Forum Guru
Posts: 4051
Joined: Wed May 11, 2011 6:08 pm

Re: OSPF and default route switching

Thu Mar 05, 2015 12:27 pm

But R2 uses it's own default gw!
That's pretty strange. I saw a post from you in a different thread about this same topic, but you stated that you need to disable/enable the floating static backup default gateway. Did that fix this issue?

That sounds like a bug to me - your output shows something that (in my opinion) clearly shows that the router should be using the OSPF default route and not the static route.
Interesting that much more people took a look at the second thread - the magic of words I think :)

Yes, if static route 0.0.0.0/0 is manually disabled and then enabled while ospf is running R2 took a correct gw. I never wrote scripts for mikrotik so it's really a poor solution.

Where should I report a bug ?
I'm curious - if the router reboots with this configuration in place, does it wake up and start working properly?
If the OSPF default route goes away and then returns (as it would if the primary ISP fails), does OSPF take back over like it should?

As for where to file bug report - I think send to customer support for ticket.
When given a spoon,
you should not cling to your fork.
The soup will get cold.
 
User avatar
ZeroByte
Forum Guru
Forum Guru
Posts: 4051
Joined: Wed May 11, 2011 6:08 pm

Re: OSPF and default route switching

Thu Mar 05, 2015 12:36 pm

I read the other thread a little more carefully, and apparently, the default always sticks, even when OSPF route comes back after failure. This just seems wrong.

I'm going to stop using this thread and focus on the other one (since it's so popular and all) :D
When given a spoon,
you should not cling to your fork.
The soup will get cold.

Who is online

Users browsing this forum: No registered users and 25 guests