Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Webcast-Catalyst9k
New Member

Next Hop Attribute in BGP

Hi All,

I've been staring at the following text for about 3 hours now and I am having trouble understanding what it is saying regarding the NEXT_HOP attribute in BGP.  I am wondering if someone might be able to translate the following excerpt from my text or explain it more clearly than it is written:

"If a prefix is injected into BGP using the "network" command and that prefix is known via an IGP, such as OSPF, then the NEXT_HOP attribute contains the IP address of the IGP next hop router. If the same prefix were advertised via BGP using the network command, the NEXT_HOP attribute would be set to the OSPF next-hop address by the local router on which the prefix is injected into BGP."

I understand the concept itself of the NEXT_HOP attribute, but I find the above example very poorly written and difficult to comprehend, but I want to understand it before I move on.

Any assistance in alternate phrasing would be greatly appreciated.  Thanks.

 

1 ACCEPTED SOLUTION

Accepted Solutions

(1.1.1.0/24)R1------R2-----

(1.1.1.0/24)R1------R2------R3

R1 (12.0.0.0/24) R2 - OSPF
R2 (23.0.0.0/24) R3 - iBGP


R2#show ip route ospf | be Gate
Gateway of last resort is not set

      1.0.0.0/24 is subnetted, 1 subnets
O        1.1.1.0 [110/2] via 12.0.0.1, 00:10:58, GigabitEthernet1/0


!
router bgp 2
 bgp log-neighbor-changes
 network 1.1.1.0 mask 255.255.255.0
!
end


R2#show ip bgp
BGP table version is 8, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>  1.1.1.0/24      
12.0.0.1                 2         32768 i

 

Injected by local router R2 (2.2.2.2) but next-hop remains unchanged

R2#show ip bgp 1.1.1.0
BGP routing table entry for 1.1.1.0/24, version 8
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Refresh Epoch 1
  Local
    12.0.0.1 from 0.0.0.0 (2.2.2.2)
      Origin IGP, metric 2, localpref 100, weight 32768, valid, sourced, local, best

R2(config)#router bgp 2
R2(config-router)#neighbor 23.0.0.3 remote-as 2
R2(config-router)#end
R2#
%SYS-5-CONFIG_I: Configured from console by console
%BGP-5-ADJCHANGE: neighbor 23.0.0.3 Up
R2#
BGP(0): 23.0.0.3 NEXT_HOP is on same subnet as the bgp peer and set to 12.0.0.1 for net 1.1.1.0/24, flags 0, sb: 0, mask: 0
BGP(0): (base) 23.0.0.3 send UPDATE (format) 1.1.1.0/24, next 12.0.0.1, metric 2, path Local

 

R3#
*Mar 23 23:26:30.143: %BGP-5-ADJCHANGE: neighbor 23.0.0.2 Up
*Mar 23 23:26:30.423: BGP(0): 23.0.0.2 rcvd UPDATE w/ attr: nexthop 12.0.0.1, origin i, localpref 100, metric 2
*Mar 23 23:26:30.427: BGP(0): 23.0.0.2 rcvd 1.1.1.0/24
*Mar 23 23:26:30.431: BGP(0): no valid path for 1.1.1.0/24

R3#show ip bgp
BGP table version is 3, local router ID is 23.0.0.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 * i 1.1.1.0/24       12.0.0.1                 2    100      0 i

 

- Vishesh

4 REPLIES

(1.1.1.0/24)R1------R2-----

(1.1.1.0/24)R1------R2------R3

R1 (12.0.0.0/24) R2 - OSPF
R2 (23.0.0.0/24) R3 - iBGP


R2#show ip route ospf | be Gate
Gateway of last resort is not set

      1.0.0.0/24 is subnetted, 1 subnets
O        1.1.1.0 [110/2] via 12.0.0.1, 00:10:58, GigabitEthernet1/0


!
router bgp 2
 bgp log-neighbor-changes
 network 1.1.1.0 mask 255.255.255.0
!
end


R2#show ip bgp
BGP table version is 8, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>  1.1.1.0/24      
12.0.0.1                 2         32768 i

 

Injected by local router R2 (2.2.2.2) but next-hop remains unchanged

R2#show ip bgp 1.1.1.0
BGP routing table entry for 1.1.1.0/24, version 8
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Refresh Epoch 1
  Local
    12.0.0.1 from 0.0.0.0 (2.2.2.2)
      Origin IGP, metric 2, localpref 100, weight 32768, valid, sourced, local, best

R2(config)#router bgp 2
R2(config-router)#neighbor 23.0.0.3 remote-as 2
R2(config-router)#end
R2#
%SYS-5-CONFIG_I: Configured from console by console
%BGP-5-ADJCHANGE: neighbor 23.0.0.3 Up
R2#
BGP(0): 23.0.0.3 NEXT_HOP is on same subnet as the bgp peer and set to 12.0.0.1 for net 1.1.1.0/24, flags 0, sb: 0, mask: 0
BGP(0): (base) 23.0.0.3 send UPDATE (format) 1.1.1.0/24, next 12.0.0.1, metric 2, path Local

 

R3#
*Mar 23 23:26:30.143: %BGP-5-ADJCHANGE: neighbor 23.0.0.2 Up
*Mar 23 23:26:30.423: BGP(0): 23.0.0.2 rcvd UPDATE w/ attr: nexthop 12.0.0.1, origin i, localpref 100, metric 2
*Mar 23 23:26:30.427: BGP(0): 23.0.0.2 rcvd 1.1.1.0/24
*Mar 23 23:26:30.431: BGP(0): no valid path for 1.1.1.0/24

R3#show ip bgp
BGP table version is 3, local router ID is 23.0.0.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 * i 1.1.1.0/24       12.0.0.1                 2    100      0 i

 

- Vishesh

Hall of Fame Super Gold

I would agree that the text

I would agree that the text is not well written and a bit confusing. Especially if you are comfortable with the concpet of next hop attribute and how it is used in BGP then the first part should not be too difficult. It says that if under router bgp there is a network statement for some prefix, and if that prefix is in the local routing table as learned from some IGP such as OSPF then the BGP next hop attribute will use the next hop from the IGP.

 

After that I think it is a bit odd. The text then says "If the same prefix were advertised via BGP..." and I expected that it was talking about something else. But it just explains the same thing again using slightly different words. So what you need to understand here is that the BGP next hop attribute will be the OSPF next hop address if the route were learned by OSPF and then was to be advertised by BGP to its peers.

 

The example given by Vishesh is a nice demonstration of that. The prefix is originally learned via OSPF with a next hop of 12.0.0.1. It is then advertised by BGP to its peer using the next hop attribute of 12.0.0.1. The concept is fairly simple and the explanation in the text makes it seem more complex.

 

HTH

 

Rick

New Member

 HI Rick, Vishesh and Milan,I

 

HI Rick, Vishesh and Milan,

I see now, thank you guys.  I had a feeling it was being explained in a far over-complicated matter than it needed to be in the text.  I'm with you now though, thanks again.

Hi, IMHO, one important fact

Hi,

 

IMHO, one important fact is missing here:

You are talking about iBGP here!

 

Generally, the default behaviour is:

When a BGP router is advertising a prefix to his iBGP neighbor, it's using the original next-hop from his RIB.

When  a BGP router is advertising a prefix to his eBGP neighbor, it's using his outgoing interface IP address as the next-hop.

 

There are some exceptions shown nicely here:

http://bgpconcepts.blogspot.cz/2008/11/bgp-nexthop.html

 

This default behaviour can be changed using

neighbor ... next-hop-self

or

neighbor ... next-hop-unchanged

command.

 

See those command references for details.

 

Best regards,

Milan

 


 

431
Views
0
Helpful
4
Replies
CreatePlease to create content