Tuesday, August 4, 2020

BGP Next Hop Attribute




Let's see the behavior of next hop for advertised prefixes over eBGP.


First, let's advertise Loopback0 on R2 so that R8 is receiving at least one prefix from R2.


R2(config)#router bgp 65100
R2(config-router)#neighbor 172.16.28.8 remote-as 65089 R2(config-router)#network 10.2.2.2 mask 255.255.255.255 R2(config-router)#end R2#

R8 is receiving prefix 10.2.2.2/32:



On R8 we can use another, fancy way to extract what prefixes are learned from a direct neighbor AS 65100 like so:

show ip bgp regex ^65100_

 

Now, on to configuring R1 and R2 iBGP peering.

R2 Configuration:

R2(config)#router bgp 65100
R2(config-router)#neighbor 172.16.123.1 remote-as 65100
R2(config-router)#end
R2#

R1 Configuration:


R1(config)#router bgp 65100
R1(config-router)#bgp router-id 10.1.1.1
R1(config-router)#neighbor 172.16.123.2 remote-as 65100
R1(config-router)#network 10.1.1.1 mask 255.255.255.255
R1(config-router)#end
R1#

First let's take a peek at R8 BGP table.

All looks good. The next hop is 172.16.28.2 which is reachable via direct link.

What about R1 BGP table?
R1 shows 11 prefixes received. However, in the above output there is no '>' (greater than) symbol next to the asterisk. The '>' symbol indicates the best path that is currently missing for all prefixes advertised by R8. As a result of that, none of the prefixes listed will be installed in the routing table.

Notice the 'next-hop-value' for these prefixes!


R1#show ip route 172.16.28.8
% Subnet not in table
R1#
R1#
R1#show ip bgp 10.8.0.0
BGP routing table entry for 10.8.0.0/28, version 0
Paths: (1 available, no best path)
  Not advertised to any peer
  Refresh Epoch 1
  65089
    172.16.28.8 (inaccessible) from 172.16.123.2 (10.2.2.2)
      Origin IGP, metric 0, localpref 100, valid, internal
R1

The next hop is preserved in eBGP advertisements (R8's interface IP address that is used for peering with R2). And it is not reachable. That is why, BGP prefixes won't get installed in the routing table.

R1#show ip route bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       + - replicated route, % - next hop override

Gateway of last resort is not set

      10.0.0.0/32 is subnetted, 2 subnets
B        10.2.2.2 [200/0] via 172.16.123.2, 00:12:00
R1#

There are a few ways of dealing with this issue.


Method 1

Use 'next-hop-self' Command on R2 for peer R1. It is the recommended command on the router that connects eBGP with iBGP peers.

router bgp 65100
 bgp router-id 10.2.2.2
 bgp log-neighbor-changes
 network 10.2.2.2 mask 255.255.255.255
 neighbor 172.16.28.8 remote-as 65089
 neighbor 172.16.123.1 remote-as 65100
 neighbor 172.16.123.1 next-hop-self
R2(config-router)#

The result on R1 is this:




R1 finds next-hop-ip reachable (direct link).
Removing this command and trying a second method.


R2(config)#router bgp 65100
R2(config-router)#no neighbor 172.16.123.1 next-hop-self
R2(config-router)#

After a 15 or so seconds the '>' best path shows up in the BGP table on R1:


And the prefixes will be installed in the routing table on R1:


Remove configuration in BGP process:

no neighbor 172.16.123.1 next-hop-self


Method 2

Change 'next-hop' attribute using route-map.


route-map NEXT_HOP permit 10
 set ip next-hop 172.16.123.2
!
router bgp 65100
 bgp router-id 10.2.2.2
 bgp log-neighbor-changes
 network 10.2.2.2 mask 255.255.255.255
 neighbor 172.16.28.8 remote-as 65089
 neighbor 172.16.123.1 remote-as 65100
 neighbor 172.16.123.1 route-map NEXT_HOP out

Remove the configuration and try the third method.


Method 3

Advertise link (IP) between R2 and R8 using an IGP protocol (for instance EIGRP/OSPF/IS-IS, etc).


R1 EIGRP Configuration:

router eigrp 100
 network 172.16.123.1 0.0.0.0
 eigrp router-id 10.1.1.1

R2 EIGRP Configuration:

router eigrp 100
 network 172.16.28.2 0.0.0.0
 network 172.16.123.2 0.0.0.0
 eigrp router-id 10.2.2.2

That does the trick as well. R1 learns how to reach next-hop 172.16.28.8 via EIGRP.

R1#show ip route 172.16.28.8
Routing entry for 172.16.28.0/24
  Known via "eigrp 100", distance 90, metric 307200, type internal
  Redistributing via eigrp 100
  Last update from 172.16.123.2 on Ethernet0/0.123, 00:04:23 ago
  Routing Descriptor Blocks:
  * 172.16.123.2, from 172.16.123.2, 00:04:23 ago, via Ethernet0/0.123
      Route metric is 307200, traffic share count is 1
      Total delay is 2000 microseconds, minimum bandwidth is 10000 Kbit
      Reliability 255/255, minimum MTU 1500 bytes
      Loading 1/255, Hops 1
R1#

And the last method would be to redistribute connected network 172.16.28.0 into IGP protocol.

Cisco Is Easy - Main

  Cisco Basics (CCNA level)  Lessons: Watch Video Tutorials on Youtube 01 - Connecting to Cisco Console Port with MINICOM 02 - Navigatin...