cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
200
Views
0
Helpful
1
Replies

Trouble getting BGP route to be primary

ajezierski
Level 1
Level 1

We have an MPLS network between locations using BGP. Several locations have a VPN connection as a backup and use OSPF for those routes.

When an MPLS link goes down, the traffic switches over to the VPN connection just fine. But when the MPLS link comes back up, the OSPF route is still overriding the BGP route.  I've changed the weights for both BGP & OSPF but still can't get the BGP route to override the OSPF route.

 

Any ideas as to what I'm missing?

 

Main router, MPLS link active at remote site:

 

nbrtr2#sh ip bgp
BGP table version is 6837, local router ID is 216.149.85.242
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path

*> 172.16.104.0/24  216.149.85.241                       300 2828 3549 2828 i

nbrtr2#sh ip bgp 172.16.104.0
BGP routing table entry for 172.16.104.0/24, version 6839
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Flag: 0x820
  Not advertised to any peer
  2828 3549 2828
    216.149.85.241 from 216.149.85.241 (216.149.85.241)
      Origin IGP, localpref 100, weight 300, valid, external, best

 

 

After shutting down the remote interface, traffic switches to the VPN link.

nbrtr2#sh ip bgp
BGP table version is 6842, local router ID is 216.149.85.242
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path

*> 172.16.104.0/24  172.16.196.4           123           100 ?

nbrtr2#sh ip bgp 172.16.104.0
BGP routing table entry for 172.16.104.0/24, version 6842
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Flag: 0x820
  Advertised to update-groups:
        1
  Local
    172.16.196.4 from 0.0.0.0 (216.149.85.242)
      Origin incomplete, metric 123, localpref 100, weight 100, valid, sourced,
best

 

 

Bringing up the remote interface, the traffic stays on the VPN.

nbrtr2#sh ip bgp

BGP table version is 6843, local router ID is 216.149.85.242
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path

*> 172.16.104.0/24  172.16.196.4           123           100 ?

nbrtr2#sh ip bgp 172.16.104.0
BGP routing table entry for 172.16.104.0/24, version 6842
Paths: (1 available, best #1, table Default-IP-Routing-Table)
  Advertised to update-groups:
        1
  Local
    172.16.196.4 from 0.0.0.0 (216.149.85.242)
      Origin incomplete, metric 123, localpref 100, weight 100, valid, sourced,
best

 

 

Finally, terminating the site-site VPN tunnel restores the MPLS route:

nbrtr2#sh ip bgp

BGP table version is 6845, local router ID is 216.149.85.242
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path

*> 172.16.104.0/24  216.149.85.241                       300 2828 3549 2828 i

 

nbrtr2#sh ip bgp 172.16.104.0
BGP routing table entry for 172.16.104.0/24, version 6845
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Flag: 0x820
  Not advertised to any peer
  2828 3549 2828
    216.149.85.241 from 216.149.85.241 (216.149.85.241)
      Origin IGP, localpref 100, weight 300, valid, external, best

 

Config details:

 

router ospf 100
 log-adjacency-changes
 redistribute static subnets
 redistribute bgp 36166 metric 20 subnets
 network 172.16.196.0 0.0.0.255 area 0
 network 172.16.224.0 0.0.3.255 area 0

router bgp 36166
 network 172.16.210.0 mask 255.255.255.0
 network 172.16.211.0 mask 255.255.255.0
 redistribute ospf 100 route-map Redist-OSPF
 neighbor 216.149.85.241 remote-as 2828
 neighbor 216.149.85.241 weight 300
 default-information originate

access-list 11 remark Define OSPF routes for redistribution
access-list 11 permit 172.16.11.0 0.0.0.255
access-list 11 permit 172.16.16.0 0.0.1.255
access-list 11 permit 172.16.196.0 0.0.1.255
access-list 11 permit 172.16.198.0 0.0.0.255
access-list 12 remark Define VPN routes for redistribution
access-list 12 permit 172.16.104.0 0.0.0.255
access-list 12 permit 192.168.1.0 0.0.0.255
access-list 12 permit 192.168.3.0 0.0.0.255
access-list 12 permit 192.168.4.0 0.0.0.255
access-list 12 permit 192.168.8.0 0.0.0.255
 

route-map Redist-OSPF permit 10
 match ip address 11
 set weight 500
!
route-map Redist-OSPF permit 20
 match ip address 12
 set weight 100
!
route-map Redist-OSPF permit 30
!

 

1 Reply 1

milan.kulik
Level 10
Level 10
Hi, IMHO, you should use the same Weight for both the BGP prefix redistributed from OSPF and received from the BGP neighbor. And set other attribute (Local Preference, e.g.) to make the prefix received from the BGP neighbor to win when the MPLS interface goes Up again. Another issue might be though: When the MPLS interface is Down, you get the OSPF prefix redistributed to your BGP table, And when the MPLS interface goes Up again, you might be advertising this prefix to the backbone. And it can beat the prefix advertised from the remote site. If it's your case, I'd also try to prepend your AS number several times to the prefix advertised from your router to make it less preferred within the backbone comparing to the original BGP prefix. Best regards, Milan.
Review Cisco Networking for a $25 gift card