Community discussions

MikroTik App
 
klasaradnicka
just joined
Topic Author
Posts: 19
Joined: Mon Aug 06, 2018 12:27 pm

BGP practice

Mon Aug 06, 2018 12:55 pm

Hello,

First of all, great forum, I love it.

I need some advice for eBGP setup, my task is to setup a dual multihomed BGP ( two uplinks to two different ISPs).
The rest of my internal network uses OSPF as IGP.

Currently , we have one ISP and that is not good enough mainly because we can not rely on a single ISP.

On a different location I ve already setup a BGP peering with different ISP, advertising only one available prefix and that is working fine, peering is establish, using a default static route to the ISP.

My idea is that I setup both BGP peers ( advertising the same prefixes) and to have two default routes, when one fails the second one becomes active and there is no downtime.

My question is , how do I make OSPF redistribute two default routes with one being a priority ?

Can I do that with making one default route having a greater AD ?
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 6045
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: BGP practice

Mon Aug 06, 2018 2:12 pm

If you are talking about setup where BGP peers are on different rotuers, then in OSPF instance change default route metric in one router to higher value.
 
klasaradnicka
just joined
Topic Author
Posts: 19
Joined: Mon Aug 06, 2018 12:27 pm

Re: BGP practice

Mon Aug 06, 2018 2:35 pm

Currently the solution you posted will work fine, but in about 2 weeks I will need to setup both BGP peers on one router, and then I will have two default routes in one router and instance will not work in that case.

Maybe , I will need to set one default route with higher Distance (2) ?
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 6045
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: BGP practice

Mon Aug 06, 2018 2:53 pm

If it is on one router then you do not need to set up anything specific, OSPF always will redistribute best route.
 
klasaradnicka
just joined
Topic Author
Posts: 19
Joined: Mon Aug 06, 2018 12:27 pm

Re: BGP practice

Tue Aug 07, 2018 10:07 am

Yes but OSPF will have two default routes to advertise, I want to make sure that all traffic goes to primary ISP

So I basically do not need to add more specific configuration ?

And thank you very much!
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 6045
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: BGP practice

Tue Aug 07, 2018 12:07 pm

No, OSPF will have only one (active) route to advertise.
 
klasaradnicka
just joined
Topic Author
Posts: 19
Joined: Mon Aug 06, 2018 12:27 pm

Re: BGP practice

Tue Dec 25, 2018 8:14 pm

Hello,

So, I setup a default static route metric in OSPF Instance in Router A (primary) to 1, a , and on router B ( secondary) to 5

Router A has a type 1 redistributedef. route : always as type 1

Router B has a type 1 redistrubute def route : always as type 2 with metric 5

So to test it I need to shutdown router A static route , since on other routers In the network Router C has a default route to Router A ?
 
mducharme
Trainer
Trainer
Posts: 981
Joined: Tue Jul 19, 2016 6:45 pm

Re: BGP practice

Wed Dec 26, 2018 3:45 am

Hello,

So, I setup a default static route metric in OSPF Instance in Router A (primary) to 1, a , and on router B ( secondary) to 5

Router A has a type 1 redistributedef. route : always as type 1

Router B has a type 1 redistrubute def route : always as type 2 with metric 5

So to test it I need to shutdown router A static route , since on other routers In the network Router C has a default route to Router A ?
I assume you are only doing this to save a hop? If your BGP is set up properly and a packet destined for the Internet arrives at router B, router B should send it to Router A which would then send it out that connection. The only reason to change the metric like this would be to try to get the packets to go to router A directly instead of possibly going through Router B followed by Router A.

EDIT: One thing I just noticed is that you said you are using a static default route to your ISP. Why are you doing that? Your ISP should give you a default route over BGP and you can use this.
 
klasaradnicka
just joined
Topic Author
Posts: 19
Joined: Mon Aug 06, 2018 12:27 pm

Re: BGP practice

Wed Dec 26, 2018 2:25 pm

Hello mducharme,

My topology goes like this

ISP 1 -- Router A ------- Router C ------- Router D ------- router F ----- Router B--- ISP 2

So I setup Router A and Router B as BGP routers, inside Routers C, D , F , A, B all use OSPF, I want to establish that when my ISP 1 is down ( it happens sometimes and I m stuck currently) that all traffic goes to Router B and ISP 2, the primary thing is default route

I ve setup OSPF as I mentioned , I am asking is this going to work as I mentioned before ?
 
mducharme
Trainer
Trainer
Posts: 981
Joined: Tue Jul 19, 2016 6:45 pm

Re: BGP practice

Wed Dec 26, 2018 10:29 pm

Hello mducharme,

My topology goes like this

ISP 1 -- Router A ------- Router C ------- Router D ------- router F ----- Router B--- ISP 2

So I setup Router A and Router B as BGP routers, inside Routers C, D , F , A, B all use OSPF, I want to establish that when my ISP 1 is down ( it happens sometimes and I m stuck currently) that all traffic goes to Router B and ISP 2, the primary thing is default route

I ve setup OSPF as I mentioned , I am asking is this going to work as I mentioned before ?
You can the redundancy you want to work, yes, but this situation is more complex than most starting out. Unfortunately this view of the network topology is a bit simplistic, since I cannot see everything, but I assume that routers C D and F form a core of sorts, with router A and B as the edge. You have to think *very* carefully about anything that can go wrong. I can see some challenges:

  1. If Router A and Router B are going to be doing your BGP, they *need* to be peered with one another because their routing tables should agree. Normally they would be next to each other, but in this case there are several hops in between. This leads to the possibility of a split brain problem in event of certain failures, covered later. Keep in mind that this also means that if a packet does arrive at Router B to go out the Internet, but Router A is properly up and running, it will send this packet to router A to go out if router A is the preferred gateway because they should agree.
  2. With a static default route on Router A and Router B, if the BGP peering goes down but the ethernet link does not, the OSPF default route will still go to router A because the route will be active. This can be solved by asking both ISPs to only give you a default route instead of a full table, then this default route will go away if the BGP peering goes down.
  3. If you do #2, which is probably best, then the problem becomes how to redistribute the default gateway into OSPF. RouterOS can do this on paper by having OSPF redistribute default "if-installed" but in practice this is not always reliable and may not work properly. On the network for my employer, we get around this by running a second AS number (a private AS) on our core routers vs. our edge with our public AS. We add a static blackhole default route on the core routers (not the edge) and they redistribute to OSPF, then once the packet gets to the core routers, they get the default through BGP so they route it to whichever border router is the default. In your case if you adopted that setup this would mean choosing a private AS number in the range 64512 to 65535, then setting up BGP on routers C D and F with that AS number (you would set up three peers, between C and D, between D and F, and between C and F, unless you use route reflectors). Then you would peer router F with router B (on your public AS) and router C with router A (on your public AS). You should also enable "remove private AS number" option on your external peerings with the ISPs on routers A and B so that you do not end up accidentally sending them routes with this private AS number in the AS path. I would like to reinforce that this may not necessarily be the best setup for you depending potentially on other issues covered later.
  4. If you have done what is in #3 above then you would have OSPF redistribute default route on possibly all of routers C D and F with a static blackhole default on each. OSPF default would then shunt the traffic from other routers (outside of those 5 above) to a point where the BGP routes would take it the rest of the way. The static blackhole default is again just a way of working around the sometimes unreliable "redistribute if-installed" option because then you can use "redistribute always" on those, since a static blackhole default is redistributed as if it were a static default route to the other routers.
  5. The other potential issue that I can see here is that of a split-brain situation. You have to think about what can happen if a link goes down internally. This would have two consequences, the first and probably least problematic is that your edge routers losing peering with each other would mean that they would both install the default for the ISP they were connected to. I don't know which default route that routers C D and F would receive in their private AS, it is more unpredictable. What would happen in this case is traffic may go out the wrong gateway, but you would still have connectivity. The second consequence is that your network could be broken into two islands by a link failure. Your diagram above is looks like a chain, where a loss of link between, say, Router A and Router C, or Router C and Router D, or Router D and Router F, or Router F and Router B would split your network in two. I do not see what redundancies are built in because you have not shown your entire network, only those 5 routers as though they were in a chain. If they are indeed in a chain like your diagram above, then a break anywhere in the chain would cause problems where the network would be split into two halves. Both halves would be able to route traffic out (assuming that both Router A and Router B were up) but if all traffic were arriving on Router A, the return traffic for the other half of the network would not get there because of the break in the link. The worst case scenario that I can see (although I haven't thought through everything) would be a link loss between Router A and Router C where Router A was still up and running and peered successfully with ISP1, which would mean that Router A would be on an island by itself and routers B-F would be still connected to each other but not to Router A. In this case, all incoming traffic would still be going to Router A (which is still up and running and connected to the Internet) but with the link to Router C down, it would have no way of getting the packets to the rest of the network, so then your failover would not work as desired.

The split brain in 4 seems problematic to me and there are other potentially other challenges that I haven't considered. You have to think carefully about what weirdness can start happening if failure X occurs for every possible failure before you roll out a specific topology. The edge routers should have redundant connectivity to each other to remove the possibility of a split brain. Another potential way is to alter the design above so that you are originating the public prefixes from a more internal router, say router C or D or F, or some combination of those. For more information see https://www.noction.com/knowledge-base/ ... figuration under the heading "Where to originate prefixes".
 
klasaradnicka
just joined
Topic Author
Posts: 19
Joined: Mon Aug 06, 2018 12:27 pm

Re: BGP practice

Fri Jan 04, 2019 2:40 pm

Thank you very much.

I m thinking of having two BGP routers next to each other, so that I dont need to think of brain split and multiple problems that can occur , also my ISPs will send me a def. route , after I will do "Redistribute if installed" as type 1 on Router A and as type 2 on router B

I have another question. I have one subnet 1.1.1.1/24 advertised to both of my ISP ( I did a few test , and this works) but now I have a problem my traffic goes to ISP 1 but unfortunately it comes back through ISP 2

So when I send traffic it goes 1.1.1.1 >>> ISP 1 but when I receive the traffic from the word it goest ISP 2 >>> Router A >>> Router c >>router D >>> 1.1.1.1

I setup a BGP prepend option to be lower on ISP 1 but this is not working, do you have any ideas ?
 
TheCiscoGuy
Frequent Visitor
Frequent Visitor
Posts: 51
Joined: Fri Jun 22, 2018 8:32 am

Re: BGP practice

Sat Jan 05, 2019 3:10 am

First check with a looking glass to make sure you are prepending the prefix from the perspective of the internet enough. Some peerings require more than a few times to get the desired effect. The second thing you could do is just change the local preference on the default being advertised via ISP2 to be preferred for internal selection. You will need to ensure your IGP metrics are correct to optimize the path. Asymetric routing mostly only affects traffic flows when security appliances are in play, a lot of networks large and small have asymetric routing without issue
Network Solutions Engineer and Trainer
Cisco | Juniper | Mikrotik | Ubiquiti
 
klasaradnicka
just joined
Topic Author
Posts: 19
Joined: Mon Aug 06, 2018 12:27 pm

Re: BGP practice

Sat Jan 05, 2019 2:37 pm

Hello CiscoGuy

Last night I ran some tests and everything is working since this morning, I ve checked with another looking glass and everything is working fine.

I ve just setup a prepend optins to prefer one ISP over another and resent that to my ISPs.
 
klasaradnicka
just joined
Topic Author
Posts: 19
Joined: Mon Aug 06, 2018 12:27 pm

Re: BGP practice

Tue Jan 08, 2019 11:07 am

Hello,

Unfortunately I had to change my topology since ISP 1 is now becoming primary ISP for all traffic , I need help now understanding this problem
Router F
|
ISP 1 -- Router A ------- Router C ------- Router D ------- router F ----- Router B--- ISP 2
|
|
Router G

Basically I have two default routes to on my Router B , static route to ISP 2 with metric 111 , and OSPF route metric 110, I can not change static route since there is a Router F needs to go to ISP 1

I need to setup that router G only him goes to ISP 2 , Can anybody help me , I was looking at the VRF and packet mark but I can not setup that yet.

I know the soultion here to add another router in the topology but is there a way so I don't need to to that ?

P.S I asked my ISP 2 and ISP 1 to send me default routes , and this is not yet done.
 
klasaradnicka
just joined
Topic Author
Posts: 19
Joined: Mon Aug 06, 2018 12:27 pm

Re: BGP practice

Tue Jan 08, 2019 11:23 am

Hello,

Unfortunately I had to change my topology since ISP 1 is now becoming primary ISP for all traffic , I need help now understanding this problem
Image
Basically I have two default routes to on my Router B , static route to ISP 2 with metric 111 , and OSPF route metric 110, I can not change static route since there is a Router F needs to go to ISP 1

I need to setup that router G only him goes to ISP 2 , Can anybody help me , I was looking at the VRF and packet mark but I can not setup that yet.

I know the soultion here to add another router in the topology but is there a way so I don't need to to that ?

P.S I asked my ISP 2 and ISP 1 to send me default routes , and this is not yet done.

Who is online

Users browsing this forum: No registered users and 15 guests