Community discussions

MikroTik App
 
Garga220
just joined
Topic Author
Posts: 7
Joined: Wed Jan 21, 2015 1:53 pm

Route selection - What am I missing?

Thu Jul 25, 2019 5:41 pm

Example:

I have two eBGP peers between one Mikrotik and one Cisco router over two different physical links.
Cisco router is originating default route on both peers and priority of the route on Mikrotik side is manipulated with "local preference".
Also, there are two static default routes with "administrative distance" over 200 on Mikrotik side.

With both links active, routing looks good, active route is eBGP route with better "local preference" of 170 and AD of 20:

[admin@MikroTik] > ip route print detail 
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 
 0 ADb  dst-address=0.0.0.0/0 gateway=172.20.48.49 gateway-status=172.20.48.49 reachable via  Vlan2992 distance=20 scope=40 target-scope=10 bgp-as-path="1212" bgp-local-pref=170 bgp-origin=igp received-from=Primary 

 1   S  ;;; Primary static
        dst-address=0.0.0.0/0 gateway=172.20.48.49 gateway-status=172.20.48.49 reachable via  Vlan2992 check-gateway=ping distance=220 scope=30 target-scope=10 

 2   S  ;;; Backup static
        dst-address=0.0.0.0/0 gateway=172.20.48.125 gateway-status=172.20.48.125 reachable via  Vlan2966 check-gateway=ping distance=230 scope=30 target-scope=10 

 3  Db  dst-address=0.0.0.0/0 gateway=172.20.48.125 gateway-status=172.20.48.125 reachable via  Vlan2966 distance=20 scope=40 target-scope=10 bgp-as-path="1212" bgp-local-pref=160 bgp-origin=igp received-from=Backup 

 4 ADC  dst-address=172.20.48.48/30 pref-src=172.20.48.50 gateway=Vlan2992 gateway-status=Vlan2992 reachable distance=0 scope=10 

 5 ADC  dst-address=172.20.48.124/30 pref-src=172.20.48.126 gateway=Vlan2966 gateway-status=Vlan2966 reachable distance=0 scope=10 

 6 ADC  dst-address=172.20.249.13/32 pref-src=172.20.249.13 gateway=Loopback 0 gateway-status=Loopback 0 reachable distance=0 scope=10

After I disconnect primary link, default static route with worse AD (230) than the Backup BGP route (20) becomes the active route:

[admin@MikroTik] > ip route print detail 
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 
 0   S  ;;; Primary static
        dst-address=0.0.0.0/0 gateway=172.20.48.49 gateway-status=172.20.48.49 unreachable check-gateway=ping distance=220 scope=30 target-scope=10 

 1 A S  ;;; Backup static
        dst-address=0.0.0.0/0 gateway=172.20.48.125 gateway-status=172.20.48.125 reachable via  Vlan2966 check-gateway=ping distance=230 scope=30 target-scope=10 

 2  Db  dst-address=0.0.0.0/0 gateway=172.20.48.125 gateway-status=172.20.48.125 reachable via  Vlan2966 distance=20 scope=40 target-scope=10 bgp-as-path="1212" bgp-local-pref=160 bgp-origin=igp received-from=Backup 

 3 ADC  dst-address=172.20.48.48/30 pref-src=172.20.48.50 gateway=Vlan2992 gateway-status=Vlan2992 reachable distance=0 scope=10 

 4 ADC  dst-address=172.20.48.124/30 pref-src=172.20.48.126 gateway=Vlan2966 gateway-status=Vlan2966 reachable distance=0 scope=10 

 5 ADC  dst-address=172.20.249.13/32 pref-src=172.20.249.13 gateway=Loopback 0 gateway-status=Loopback 0 reachable distance=0 scope=10

MT configuration:

[admin@MikroTik] > export compact 
# jan/02/1970 01:23:54 by RouterOS 6.44.5
# software id = HXN9-361D
# model = RouterBOARD 3011UiAS

/interface bridge
add name=BD-PtP-Backup
add name=BD-PtP-Primary
add name="Loopback 0"
/interface ethernet
set [ find default-name=sfp1 ] comment=Backup-link name=Gi0/1
set [ find default-name=ether1 ] comment=Primarni-link name=Gi1/1
/interface vlan
add interface=BD-PtP-Backup name=Vlan2966 vlan-id=2966
add interface=BD-PtP-Primary name=Vlan2992 vlan-id=2992
/routing bgp instance
set default as=64532 redistribute-connected=yes redistribute-static=yes router-id=172.20.249.13
/interface bridge port
add bridge=BD-PtP-Backup hw=no interface=Gi0/1
add bridge=BD-PtP-Primary hw=no interface=Gi1/1
/ip address
add address=172.20.48.50/30 interface=Vlan2992 network=172.20.48.48
add address=172.20.48.126/30 interface=Vlan2966 network=172.20.48.124
add address=172.20.249.13 interface="Loopback 0" network=172.20.249.13
/ip route
add check-gateway=ping comment="Primary static" distance=220 gateway=172.20.48.49
add check-gateway=ping comment="Backup static" distance=230 gateway=172.20.48.125
/routing bgp peer
add hold-time=1m in-filter=BGP_UPSTREAM-1_ALL_IN keepalive-time=20s name=Primary out-filter=BGP_UPSTREAM-1_ALL_OUT remote-address=172.20.48.49 remote-as=1212 ttl=default
add hold-time=1m in-filter=BGP_UPSTREAM-2_ALL_IN keepalive-time=20s name=Backup out-filter=BGP_UPSTREAM-2_ALL_OUT remote-address=172.20.48.125 remote-as=1212 ttl=default
/routing filter
add chain=BGP_UPSTREAM-1_ALL_OUT set-bgp-communities=1212:10170
add chain=BGP_UPSTREAM-2_ALL_OUT set-bgp-communities=1212:10160
add chain=BGP_UPSTREAM-3_ALL_OUT set-bgp-communities=1212:10150
add chain=BGP_UPSTREAM-1_ALL_IN set-bgp-local-pref=170
add chain=BGP_UPSTREAM-2_ALL_IN set-bgp-local-pref=160
add chain=BGP_UPSTREAM-3_ALL_IN set-bgp-local-pref=150

Mikrotik wiki: "If a router learns about a destination from more than one routing protocol, administrative distance is compared and the preference is given to the routes with lower administrative distance."

So the question is: What am I missing?
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7057
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Route selection - What am I missing?  [SOLVED]

Thu Jul 25, 2019 5:58 pm

How route selection is made in v6 you will not get other BGP route active because BGP does not trigger best path selection algorithm in this situation.

Order is as follows:

* BGP elects best route from all received BGP routes using best path selection algorithm.
* BGP marks the route as candidate route to be selected as best between other best candidate routes from other protocols (static, ospf, etc)
* Main routing process sees that candidate BGP route has lowest distance and marks it as Active

Now when active BGP route is removed:
* main routing process picks next best route from all candidate routes.
* since BGP best path selection algorithm is not re-run next best becomes static route with lowest distance.
 
Garga220
just joined
Topic Author
Posts: 7
Joined: Wed Jan 21, 2015 1:53 pm

Re: Route selection - What am I missing?

Fri Jul 26, 2019 2:53 pm

Thanks for the answer.

I guess that Mikrotik will not change this behavior?
Is there a workaround?
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7057
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Route selection - What am I missing?

Fri Jul 26, 2019 3:01 pm

Will not be changed in current implementation, but there are plans to redo this part in new implementation on which we are working right now.

Who is online

Users browsing this forum: No registered users and 7 guests