cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2082
Views
10
Helpful
3
Replies

OSPF route preferred over BGP route

rick505d3
Level 1
Level 1

Hi,

In the network below, the objective is redundant reachability to prefix 1.1.1.1 (say public cloud hosting) routers csr2 and csr3 (internal network).

Screenshot 2021-05-02 163554.jpg

 

In the order of operations, BGP was configured and verified first, followed by OSPF configuration. The working state is like this - csr2 and csr3 can reach 1.1.1. directly via BGP:

 

 

csr2#show ip bgp 1.1.1.1
BGP routing table entry for 1.1.1.1/32, version 2
Paths: (1 available, best #1, table default)
Not advertised to any peer
Refresh Epoch 1
1, (received & used)
10.0.12.1 from 10.0.12.1 (1.1.1.1)
Origin IGP, metric 0, localpref 100, valid, external, best
rx pathid: 0, tx pathid: 0x0

csr2#show ip ospf database ext 1.1.1.1

            OSPF Router with ID (2.2.2.2) (Process ID 1)

                Type-5 AS External Link States

  LS age: 82
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 1.1.1.1 (External Network Number )
  Advertising Router: 2.2.2.2
  LS Seq Number: 80000001
  Checksum: 0x9704
  Length: 36
  Network Mask: /32
        Metric Type: 2 (Larger than any link state path)
        MTID: 0
        Metric: 1
        Forward Address: 0.0.0.0
        External Route Tag: 12

  LS age: 45
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 1.1.1.1 (External Network Number )
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000001
  Checksum: 0x8B0B
  Length: 36
  Network Mask: /32
        Metric Type: 2 (Larger than any link state path)
        MTID: 0
        Metric: 1
        Forward Address: 0.0.0.0
        External Route Tag: 13

csr3#show ip bgp 1.1.1.1
BGP routing table entry for 1.1.1.1/32, version 2
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Refresh Epoch 2
  1, (received & used)
    10.0.13.1 from 10.0.13.1 (1.1.1.1)
      Origin IGP, metric 0, localpref 100, valid, external, best
      rx pathid: 0, tx pathid: 0x0

csr3#show ip ospf data ext 1.1.1.1

            OSPF Router with ID (3.3.3.3) (Process ID 1)

                Type-5 AS External Link States

  LS age: 214
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 1.1.1.1 (External Network Number )
  Advertising Router: 2.2.2.2
  LS Seq Number: 80000001
  Checksum: 0x9704
  Length: 36
  Network Mask: /32
        Metric Type: 2 (Larger than any link state path)
        MTID: 0
        Metric: 1
        Forward Address: 0.0.0.0
        External Route Tag: 12

  LS age: 176
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 1.1.1.1 (External Network Number )
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000001
  Checksum: 0x8B0B
  Length: 36
  Network Mask: /32
        Metric Type: 2 (Larger than any link state path)
        MTID: 0
        Metric: 1
        Forward Address: 0.0.0.0
        External Route Tag: 13


 

 

 

Now, shut/no shut the BGP neigh 10.0.12.1 on csr2 - or shut/noshut the interface long enough for bgp to go down. The state now looks like this:

csr2#show ip bgp 1.1.1.1
BGP routing table entry for 1.1.1.1/32, version 7
Paths: (2 available, best #2, table default)
  Not advertised to any peer
  Refresh Epoch 2
  1, (received & used)
    10.0.12.1 from 10.0.12.1 (1.1.1.1)
      Origin IGP, metric 0, localpref 100, valid, external
      rx pathid: 0, tx pathid: 0
  Refresh Epoch 1
  Local
    10.0.23.3 from 0.0.0.0 (2.2.2.2)
      Origin incomplete, metric 1, localpref 100, weight 32768, valid, sourced, best
      rx pathid: 0, tx pathid: 0x0


csr2#show ip ospf data ext 1.1.1.1

            OSPF Router with ID (2.2.2.2) (Process ID 1)

                Type-5 AS External Link States

  LS age: 358
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 1.1.1.1 (External Network Number )
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000001
  Checksum: 0x8B0B
  Length: 36
  Network Mask: /32
        Metric Type: 2 (Larger than any link state path)
        MTID: 0
        Metric: 1
        Forward Address: 0.0.0.0
        External Route Tag: 13

csr2#show ip route 1.1.1.1
Routing entry for 1.1.1.1/32
  Known via "ospf 1", distance 110, metric 1
  Tag 13, type extern 2, forward metric 1
  Redistributing via bgp 2
  Advertised by bgp 2 match internal external 1 & 2
  Last update from 10.0.23.3 on GigabitEthernet3, 00:28:14 ago
  Routing Descriptor Blocks:
  * 10.0.23.3, from 3.3.3.3, 00:28:14 ago, via GigabitEthernet3
      Route metric is 1, traffic share count is 1
      Route tag 13

csr3#show ip bgp 1.1.1.1
BGP routing table entry for 1.1.1.1/32, version 2
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Refresh Epoch 3
  1, (received & used)
    10.0.13.1 from 10.0.13.1 (1.1.1.1)
      Origin IGP, metric 0, localpref 100, valid, external, best
      rx pathid: 0, tx pathid: 0x0

csr3#show ip ospf data ext 1.1.1.1

            OSPF Router with ID (3.3.3.3) (Process ID 1)

                Type-5 AS External Link States

  LS age: 375
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 1.1.1.1 (External Network Number )
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000001
  Checksum: 0x8B0B
  Length: 36
  Network Mask: /32
        Metric Type: 2 (Larger than any link state path)
        MTID: 0
        Metric: 1
        Forward Address: 0.0.0.0
        External Route Tag: 13

csr3#show ip route 1.1.1.1
Routing entry for 1.1.1.1/32
  Known via "bgp 2", distance 20, metric 0
  Tag 1, type external
  Redistributing via ospf 1
  Advertised by ospf 1 subnets tag 13
  Last update from 10.0.13.1 00:36:12 ago
  Routing Descriptor Blocks:
  * 10.0.13.1, from 10.0.13.1, 00:36:12 ago
      Route metric is 0, traffic share count is 1
      AS Hops 1
      Route tag 1
      MPLS label: none

Here, if I shut/noshut csr2:G3 (to drop/re-estab ospf adj), then csr2 will route to 1.1.1.1 via bgp again.

 

What's causing this behavior and how to fix this?

 

 

Thanks,

Rick.

1 Accepted Solution

Accepted Solutions

Hi Elliot,

 

Duplicate post got created when this one got marked as Spam, don't know why, and not visible on the forum for some time. @Moderator , please delete this post. Actual post with discussion / solution HERE.

 

Regards,

Rick.

View solution in original post

3 Replies 3

It is kind of hard to say for sure without seeing the configs, but I wonder if the problem is that you are sourcing BGP routes from a loopback interface, but there isn't a route to that IP (note the "incomplete" in the BGP table). I don't see the BGP ASN's in there either, but an iBGP route (same ASN) would be less preferred than an OSPF route based on admin distance (iBGP = 200, OSPF = 110, eBGP = 20).

Hi Elliot,

 

Duplicate post got created when this one got marked as Spam, don't know why, and not visible on the forum for some time. @Moderator , please delete this post. Actual post with discussion / solution HERE.

 

Regards,

Rick.

Hello
Duplicate post - 


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the community’s global network.

Kind Regards
Paul
Review Cisco Networking for a $25 gift card