Most of time we might prefer to configure loopback interfaces to establish BGP neighbors because, as long as the router stays up, loopback interfaces will stay up as well. However, we need to tweak the BGP configuration. For example we need to update the source of the neighbor with the interface (loopback) we want to use. We can do that by using the command (neighbor x.x.x.x update-source loopback [x]), but also we need the use of “eBGP Multihop” command as well.
This is because when BGP form the TCP connection to advertise the network, the router IOS sets the “Time To Live” (TTL) to a value of 1. This a keepalive mechanism to prevent routes from being looping in the network. By configuring loopbacks as as a neighbor, the neighbor router will discard the packet because of the TTL value of 1 is decremented to 0. Even though the loopback’s interface is not directly connected, we want to make the router believes that is directly connected by using “ebgp-multihop” command.
NOTE: Remember that BGP assumed that the neighbors are always directly connected, even if it is not; which happens most of the time.
An illustrated example will show how does it work:
I have set up a lab to demonstrate the concept of eBGP Multihop using GNS3
When I run the “debug ip packets” command on R1, it is showing R1 using “IP=184.108.40.206” as source and “IP=220.127.116.11” as destination
Also when running a packet capture using “Wireshark,” it is showing R1 using “lo1 = 18.104.22.168” as source and “R2 lo2 =22.214.171.124” as destination. Also, we can see the TCP socket opened, using a general port :34359 as source port and a “BGP TCP port 179 as destination (This will be a connection initiated by R1 to R2)
We can see that “TCP hand shake” has taken place, confirming that BGP neighbors has been formed: