I've a question related to BGP configuration. If I'm using the update-source loopback or next-hop-self commands, will they modify the source IP address in the packet?

Assume R1 has an eBGP session with R2 and iBGP session with R3 and R4. R1 uses the command update-source loopback and sends the packet to R3. Now, the source IP address of the packet has been changed. R3 forwards the packet to its destination through some other peer. Now, when the packet comes from destination, it wont be having the correct source address from where packet came because of the command update-source loopback. So, does BGP handle this case?

Same for the next-hop-self command. R2 can use this command while sending the packets to R3 or R4, and further they can send to their peers.

Can someone please clarify my doubts?

  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can provide and accept your own answer.
    – Ron Maupin
    Feb 19 '18 at 19:48

The two commands are for completely different reasons, and they do not modify addresses on packets. The update-source command will try to form a neighbor relationship using an address different than the directly connected address, while the next-hop-self command tells a neighbor where to send packets when the neighbor doesn't know how to reach the advertising router.

If you are using eBGP, and the update-source command, you must understand a few things. The eBGP peer must have a route to the interface in the update-source command in order to form a neighbor. That would involve using a different routing protocol or static routing for the eBGP neighbor to be able to reach the interface in the update-source command. That is why it is normally only used for iBGP. Also, with eBGP, you muse use the ebgp multihop command, otherwise it will not work. This command is for forming the BGP neighbor connection.

The next-hop-self command has nothing to do with the addresses on packets. That command simply tells the neighbor that it should send packets toward the destination to the router with that command. It is used in cases where the neighbor router doesn't know how to reach the advertising router, but the router with the next-hop-self command does. This command is for advertising route direction.


First thing to understand here is

  1. update-source loopback and
  2. next-hop-self

are commands used for the BGP establishment/BGP route learning. We basically use TCP 3 way handshake mechanism to help establish BGP session between two routers.

In example if we have the following setup R1 - R2 - R3. ( Trying to establish BGP session between R1 and R3)

We would define loopbacks for R1, R2 and R3 as, and respectively. All of these 3 loopbacks would be known to all the three routers through >the OSPF sessions between R1 and R2 and R2 and R3. Now since we want to establish BGP session between R1 and R3 we would do >the following on each of the routers

On R1

  1. define neighbour as
  2. Give update-source loopback as

On R3

  1. Define neighbour as
  2. Give update-source loopback as 3.3.3.

By doing the above TCP 3 way handshake is initiated. Could be started by R1 or R3. So let's assume R1 initiates the TCP then,

  1. R1 sends a SYN message with source address as to R2 and further fowarded to R3.
  2. R3 receives the SYN and sends back a SYN-ACK with Destination as the source address from SYN message. This is sent to R2 and further R1.

  3. R1 sends a ACK to R3 and BGP is established.

So I hope this clarifies the update-source loopback doubt.

Next-hop self comes into play when we have routes learnt between two e-BGP sessions. Please refer to this for more info.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy