Community discussions

MikroTik App
 
User avatar
amt
Long time Member
Long time Member
Topic Author
Posts: 529
Joined: Fri Jan 16, 2015 2:05 pm

help on adding second gateway with distance=2

Tue Nov 28, 2017 4:08 pm

First of all hello to everyone,
I tried to change network type from bridge to routed network, but I have some problems and I am very happy if you can help me in this matter.
I shared a little work below to explain the problem I am experiencing.
networkdraw-2.png


tower A has two connections, one of them comes through Tower G and the other comes through Tower M, and I want to run connection over Tower M when the incoming connection through Tower G does not work. So I added a second gateway to feed through Tower M and made distance 2. but the problem I have encountered is; When the connection between tower D and tower G is disconnected, the second gateway does not switch on because tower A controls the first gateway 10.10.2.65 ip address.

Thanks...
You do not have the required permissions to view the files attached to this post.
Last edited by amt on Tue Nov 28, 2017 7:03 pm, edited 1 time in total.
 
pe1chl
Forum Guru
Forum Guru
Posts: 10568
Joined: Mon Jun 08, 2015 12:09 pm

Re: help on adding second gateway with distance=2

Tue Nov 28, 2017 4:57 pm

Use an autorouting protocol (OSPF or BGP) to do your routes. In each location you configure the neighbor locations only.
The autorouting protocol will rebuild your route tables when one link fails.
 
Posse7x
just joined
Posts: 12
Joined: Thu Oct 06, 2016 4:11 pm

Re: help on adding second gateway with distance=2

Tue Nov 28, 2017 6:36 pm

the problem is tower m is monitoring the connection to tower g
as long as this connection works the second route won't work

so you need to monitor an ip address behind your gw

route1:
/ip route
add check-gateway=ping distance=1 dst-address=8.8.8.8(=high available ip or secound ip from tower d) gateway=10.10.2.65 scope=10
add check-gateway=ping distance=1 dst-address=0.0.0.0/0 (#network you want to reach)gateway=8.8.8.8 (#high available IP or second ip from tower D)


/ip route
add distance=2 dst-address=0.0.0.0/0 gateway=10.10.2.205
#failover route

to make this configuration work you need to block access to 8.8.8.8 from wan2 ( output dst-address 8.8.8.8 block interface wan2)

hope this one helps

regards
MP
 
Posse7x
just joined
Posts: 12
Joined: Thu Oct 06, 2016 4:11 pm

Re: help on adding second gateway with distance=2

Tue Nov 28, 2017 6:37 pm

the problem is tower m is monitoring the connection to tower g
as long as this connection works the second route won't work

so you need to monitor an ip address behind your gw

route1:
/ip route
add check-gateway=ping distance=1 dst-address=8.8.8.8(=high available ip or secound ip from tower d) gateway=10.10.2.65 scope=10
add check-gateway=ping distance=1 dst-address=0.0.0.0/0 (#network you want to reach)gateway=8.8.8.8 (#high available IP or second ip from tower D)


/ip route
add distance=2 dst-address=0.0.0.0/0 gateway=10.10.2.205
#failover route

to make this configuration work you need to block access to 8.8.8.8 from wan2 ( output dst-address 8.8.8.8 block interface wan2)

hope this one helps

regards
MP
 
User avatar
amt
Long time Member
Long time Member
Topic Author
Posts: 529
Joined: Fri Jan 16, 2015 2:05 pm

Re: help on adding second gateway with distance=2

Tue Nov 28, 2017 7:09 pm

pe1chl wrote:
Use an autorouting protocol (OSPF or BGP) to do your routes. In each location you configure the neighbor locations only.
The autorouting protocol will rebuild your route tables when one link fails.


Hi pe1chl,

Yes I build ospf between them.. and ospf running. But its not helped me for this situation or i made a mistake on settings. I'm not sure if its correct but I also increase the cost from 10 to 20 connection between Tower M And Tower A both side for make this link as backup.

Thanks
 
pe1chl
Forum Guru
Forum Guru
Posts: 10568
Joined: Mon Jun 08, 2015 12:09 pm

Re: help on adding second gateway with distance=2

Tue Nov 28, 2017 7:18 pm

You can distribute your default route via the routing protocol you use. So not put a hardwired default route in each router.
Then it will point the correct way according to what the routing protocol has decided.
You do this by advertising the default route from the point(s) where the internet connection is made and forward it through your network just like the other routes.
(although default route is usually a special case for strange reasons)
 
User avatar
amt
Long time Member
Long time Member
Topic Author
Posts: 529
Joined: Fri Jan 16, 2015 2:05 pm

Re: help on adding second gateway with distance=2

Tue Nov 28, 2017 7:21 pm

Posse7x wrote:
the problem is tower m is monitoring the connection to tower g
as long as this connection works the second route won't work

so you need to monitor an ip address behind your gw

route1:
/ip route
add check-gateway=ping distance=1 dst-address=8.8.8.8(=high available ip or secound ip from tower d) gateway=10.10.2.65 scope=10
add check-gateway=ping distance=1 dst-address=0.0.0.0/0 (#network you want to reach)gateway=8.8.8.8 (#high available IP or second ip from tower D)


/ip route
add distance=2 dst-address=0.0.0.0/0 gateway=10.10.2.205
#failover route

to make this configuration work you need to block access to 8.8.8.8 from wan2 ( output dst-address 8.8.8.8 block interface wan2)

hope this one helps

regards
MP


Hi Posse,
I increase the target-scope to 40 and write Tower D address for gateway as like this and it seems its work..
/ip route
add check-gateway=ping distance=1 gateway=10.10.2.89 target-scope=40
add check-gateway=ping distance=2 gateway=10.10.2.205


I will test your solution also.
Thanks.
 
User avatar
amt
Long time Member
Long time Member
Topic Author
Posts: 529
Joined: Fri Jan 16, 2015 2:05 pm

Re: help on adding second gateway with distance=2

Tue Nov 28, 2017 7:40 pm

pe1chl wrote:
You can distribute your default route via the routing protocol you use.

Should i enable it on all devices that working with ospf ? And some of this p 2 p links are radiolink and I should enter gateway manually.
pe1chl wrote:
So not put a hardwired default route in each router.

You mean not write gateway manually ?

pe1chl wrote:
Then it will point the correct way according to what the routing protocol has decided.
You do this by advertising the default route from the point(s) where the internet connection is made and forward it through your network just like the other routes.

İnternet connections comes over RouterA. Should i only advertising default route at RouterA and dont need at others ?
 
pe1chl
Forum Guru
Forum Guru
Posts: 10568
Joined: Mon Jun 08, 2015 12:09 pm

Re: help on adding second gateway with distance=2

Tue Nov 28, 2017 7:49 pm

Well I normally use BGP but it should be the same with OSPF.
Every device has association with the neighbors only and the default route is just one of the routes distributed by the routing protocol.
Like every route it originates at some point (in this case router A) and all other routers learn its path along the other routers just like any route.
So there is no need to have a manual default route anywhere. It can just be left out and it will be populated by the routing protocol.
But be careful: the default route 0.0.0.0/0 is usually only transmitted when this is explicitly configured.
In BGP: default-originate=if-installed
When you don't set the proper option it will not work.
 
User avatar
amt
Long time Member
Long time Member
Topic Author
Posts: 529
Joined: Fri Jan 16, 2015 2:05 pm

Re: help on adding second gateway with distance=2

Tue Nov 28, 2017 8:29 pm

Well I normally use BGP but it should be the same with OSPF.
Every device has association with the neighbors only and the default route is just one of the routes distributed by the routing protocol.
Like every route it originates at some point (in this case router A) and all other routers learn its path along the other routers just like any route.
So there is no need to have a manual default route anywhere. It can just be left out and it will be populated by the routing protocol.
But be careful: the default route 0.0.0.0/0 is usually only transmitted when this is explicitly configured.
In BGP: default-originate=if-installed
When you don't set the proper option it will not work.
Thanks I will try this method. in ospf redistribute-default route has many option like always(as type 1) or if installed as(as type 1) I select always(as type1 ) on router A. and i will remove gateway's which are manually added from other routers. and i will not choose redistribute-default route on other routers. correct ?
 
pe1chl
Forum Guru
Forum Guru
Posts: 10568
Joined: Mon Jun 08, 2015 12:09 pm

Re: help on adding second gateway with distance=2

Wed Nov 29, 2017 1:27 pm

I have no detailed knowledge about OSPF but I would not select "always". I would use "if installed".
That is what I use in BGP and it makes sure it only forwards the default route it gets from others, not claim it has it while it really hasn't.
 
User avatar
amt
Long time Member
Long time Member
Topic Author
Posts: 529
Joined: Fri Jan 16, 2015 2:05 pm

Re: help on adding second gateway with distance=2

Wed Nov 29, 2017 2:21 pm

I have no detailed knowledge about OSPF but I would not select "always". I would use "if installed".
That is what I use in BGP and it makes sure it only forwards the default route it gets from others, not claim it has it while it really hasn't.
Hi pe1chl,
thanks for your info, I selected always and remove all manually added gateway from other routers, its worked .

But I want to consult for this also; some Tower's has two connection and I let their cost=10 which are the main links. and I increase cost=20 for other link to make it as backup link. for example I prefer to use link as main which comes from TowerG to TowerA and link from TowerM to TowerA as backup link so I increase cost at both side of TowerM to TowerA link. I hope this is the correct way. you said me you have no detail info about OSPF but I wrote here to may another person getting touch this topic.

Thanks a lot