BGP Nexthop Attribute
The BGP nexthop attribute is the next hop IP address that is going to be used to reach a certain destination.
For EBGP, the next hop is always the IP address of the neighbor specified in the neighbor command. In the above example, RTC will advertise 170.10.0.0 to RTA with a next hop of 170.10.20.2 and RTA will advertise 150.10.0.0 to RTC with a next hop of 170.10.20.1. For IBGP, the protocol states that the next hop advertised by EBGP should be carried into IBGP. Because of that rule, RTA will advertise 170.10.0.0 to its IBGP peer RTB with a next hop of 170.10.20.2. So according to RTB, the next hop to reach 170.10.0.0 is 170.10.20.2 and not 150.10.30.1.
You should make sure that RTB can reach 170.10.20.2 via IGP, otherwise RTB will drop packets destined to 170.10.0.0 because the next hop address would be inaccessible. For example, if RTB is running IGRP you could also run igrp on RTA network 170.10.0.0. You would want to make IGRP passive on the link to RTC so BGP is only exchanged.
RTA#
router bgp 100
neighbor 170.10.20.2 remote−as 300
neighbor 150.10.50.1 remote−as 100
network 150.10.0.0
RTB#
router bgp 100
neighbor 150.10.30.1 remote−as 100
RTC#
router bgp 300
neighbor 170.10.20.1 remote−as 100
network 170.10.0.0
*RTC will advertise 170.10.0.0 to RTA with a NextHop 170.10.20.2
*RTA will advertise 170.10.0.0 to RTB with a NextHop= 170.10.20.2
(The external NextHop via EBGP is sent via IBGP)
BGP Nexthop (Multiaccess Networks)
The following example shows how the nexthop will behave on a multiaccess network such as ethernet.
Assume that RTC and RTD in AS300 are running OSPF. RTC is running BGP with RTA. RTC can reach network 180.20.0.0 via 170.10.20.3. When RTC sends a BGP update to RTA regarding 180.20.0.0 it will use as next hop 170.10.20.3 and not its own IP address (170.10.20.2). This is because the network between RTA, RTC and RTD is a multiaccess network and it makes more sense for RTA to use RTD as a next hop to reach 180.20.0.0 rather than making an extra hop via RTC.
*RTC will advertise 180.20.0.0 to RTA with a NextHop 170.10.20.3.
If the common media to RTA, RTC and RTD was not multiaccess, but NBMA (Non Broadcast Media Access) then further complications will occur.
BGP Nexthop (NBMA)
If the common media as you see in the shaded area above is a frame relay or any NBMA cloud then the exact behavior will occur as if we were connected via ethernet. RTC will advertise 180.20.0.0 to RTA with a next hop of 170.10.20.3.
The problem is that RTA does not have a direct PVC to RTD, and cannot reach the next hop. In this case routing will fail.
In order to remedy this situation a command called NextHopself is created.
Nexthopself
Because of certain situations with the nexthop as we saw in the previous example, a command called next−hop−self is created. The syntax is:
neighbor {ip−address|peer−group−name} next−hop−selfThe next−hop−self command allows us to force BGP to use a specified IP address as the next hop rather than letting the protocol choose the next hop.
In the previous example, the following configuration solves our problem:
RTC#
router bgp 300
neighbor 170.10.20.1 remote−as 100
neighbor 170.10.20.1 next−hop−self
RTC advertises 180.20.0.0 with a NextHop = 170.10.20.2