BGP Routing – Why BGP Chooses Wrong Next-Hop Address

bgpciscorouting

enter image description here

In diagram above R1 has got a loopback with 1.1.1.1/24 ip address, both R1 and R2 advertise out this network 1.1.1.0/24 to other AS using this router bgp network config: network 1.1.1.0 mask 255.255.255.0

R1 and R2 are iBGP peers

R1 is peer with R3 in AS 200

R2 is peer with R4 in As 200

The problem is R2 advertises 1.1.1.0/24 as this:

* i1.1.1.0/24       10.1.12.1                0    100      0 i
*>                  10.1.12.1               11         32768 i



R2# sh ip bgp 1.1.1.0 255.255.255.0  
BGP routing table entry for 1.1.1.0/24, version 9
Paths: (2 available, best #2, table Default-IP-Routing-Table)
  Advertised to update-groups:
     1          2         
  Local
    10.1.12.1 from 10.1.12.1 (1.1.1.1)
      Origin IGP, metric 0, localpref 100, valid, internal
  Local
    10.1.12.1 from 0.0.0.0 (2.2.2.2)
      Origin IGP, metric 11, localpref 100, weight 32768, valid, sourced, local, best

It sees itself as the nexthop and uses that as best route:

Local
        10.1.12.1 from 0.0.0.0 (2.2.2.2)
          Origin IGP, metric 11, localpref 100, weight 32768, valid, sourced, local, best

So why is this happening? Why does R2 advertise 1.1.1.0/24 back to R1? Why should R2 do that?

The same outputs from R1 in the case you need to check them out:

*> 1.1.1.0/24       0.0.0.0                  0         32768 i
* i                 10.1.12.2               11    100      0 i

R1#sh ip bgp 1.1.1.0 255.255.255.0
BGP routing table entry for 1.1.1.0/24, version 11
Paths: (2 available, best #1, table Default-IP-Routing-Table)
  Advertised to update-groups:
     1          2      
  Local
    0.0.0.0 from 0.0.0.0 (1.1.1.1)
      Origin IGP, metric 0, localpref 100, weight 32768, valid, sourced, local, best
  Local
    10.1.12.2 from 10.1.12.2 (2.2.2.2)
      Origin IGP, metric 11, localpref 100, valid, internal

Best Answer

Because you are telling R2 to originate the route. Upon origination the weight is set to 32768 as you can see, which beats the route from R1 which has a weight of 0. This allows R2 to advertise it back to R1 as it is R2's bestpath. If you remove the network statement on R2 it will receive the route as a BGP route via R1 only.

Check out the bestpath selection procedure for more info http://www.cisco.com/c/en/us/support/docs/ip/border-gateway-protocol-bgp/13753-25.html

Related Topic