EBGP Multihop
Network topology:
An eBGP session will be setup between R0 & R1 routers using their Loopback interfaces. Static routes are configured between R0 and R1 routers to reach the Loopback interfaces. The primary path to reach 2.2.2.2 from R0 is through SW0. A floating static route (AD=254) is also configured through SW2.
The multihop eBGP connection is configured using neighbor ebgp-multihop <value> command under BGP. The "value" indicates the number of hops. The range of "value" is 1 to 255. Since BGP session is to be formed between Loopback interfaces, technically, that is one hop away from the routers.
R0 configuration
interface Loopback0 ip address 1.1.1.1 255.255.255.255!interface FastEthernet0/0 ip address 10.1.1.1 255.255.255.0!interface FastEthernet0/1 ip address 10.2.2.1 255.255.255.0!router bgp 100 no synchronization bgp log-neighbor-changes neighbor 2.2.2.2 remote-as 200 neighbor 2.2.2.2 ebgp-multihop 2 neighbor 2.2.2.2 update-source Loopback0 no auto-summary!ip route 2.2.2.2 255.255.255.255 10.1.1.2 track 10ip route 2.2.2.2 255.255.255.255 10.2.2.2 254!ip sla 1 icmp-echo 2.2.2.2 source-interface FastEthernet0/0 timeout 3000 threshold 2 frequency 3ip sla schedule 1 life forever start-time now!track 10 rtr 1 reachability delay down 10 up 15!As seen below, R0 uses static route (default AD of 1) to reach 2.2.2.2.
Static route for 2.2.2.2
R0# show ip route 2.2.2.2Routing entry for 2.2.2.2/32 Known via "static", distance 1, metric 0 Routing Descriptor Blocks: * 10.1.1.2 Route metric is 0, traffic share count is 1Prefix 192.168.2.0 is advertised by R1 router via BGP. When R0 receives this prefix via eBGP connection, it installs in its BGP table first and the next-hop for 192.168.2.0 prefix will be the BGP Router ID of R1 i.e. 2.2.2.2. BGP performs recursive routing to find out the outgoing interface and checks if it can reach the next-hop before declaring the route as "best route" and installing in the routing table.
Recursive routing
R0# show ip cef 192.168.2.0192.168.2.0/24, version 18, epoch 0, cached adjacency 10.1.1.20 packets, 0 bytes via 2.2.2.2, 0 dependencies, recursive next hop 10.1.1.2, FastEthernet0/0 via 2.2.2.2/32 valid cached adjacencyR0# show ip cef 2.2.2.22.2.2.2/32, version 17, epoch 0, cached adjacency 10.1.1.20 packets, 0 bytes via 10.1.1.2, 1 dependency, recursive next hop 10.1.1.2, FastEthernet0/0 via 10.1.1.2/32 valid cached adjacencyBGP Session
R0# show ip bgp neighbors | include BGP state|Connections established|Last reset BGP state = Established, up for 00:29:55 Connections established 1; dropped 0 Last reset neverFailover- When FastEthernet 0/0 interface of R1 is shutdown manually
When Fa 0/0 interface of R1 is shutdown, the state of tracking object goes down and the floating static route becomes active. Hence, 2.2.2.2 is now reachable via SW2.
Floating static route
00:37:35.883: %TRACKING-5-STATE: 10 rtr 1 reachability Up->DownR0# show ip route 2.2.2.2Routing entry for 2.2.2.2/32 Known via "static", distance 254, metric 0 Routing Descriptor Blocks: * 10.2.2.2 Route metric is 0, traffic share count is 1The outgoing interface changes to Fa 0/1 for all routes advertised by R1 to R0.
After Failover: BGP entries
R0# show ip cef 192.168.2.0192.168.2.0/24, version 18, epoch 0, cached adjacency 10.2.2.20 packets, 0 bytes via 2.2.2.2, 0 dependencies, recursive next hop 10.2.2.2, FastEthernet0/1 via 2.2.2.2/32 valid cached adjacencyR0# show ip cef 2.2.2.22.2.2.2/32, version 19, epoch 0, cached adjacency 10.2.2.20 packets, 0 bytes via 10.2.2.2, 1 dependency, recursive next hop 10.2.2.2, FastEthernet0/1 via 10.2.2.2/32 valid cached adjacencyThe following output clearly shows that the BGP session stays "established" during failover.
BGP session after failover
R0# show ip bgp neighbors | include BGP state|Connections established|Last reset BGP state = Established, up for 00:30:55 Connections established 1; dropped 0 Last reset neverBGP Next-hop reachability using a default route 0.0.0.0/0
A default-route 0.0.0.0/0 is only configured on R0 for reachability to 2.2.2.2. It shows that a BGP session is still established without a more specific route to 2.2.2.2.
Default-route with BGP on R0
R0(config)# ip route 0.0.0.0 0.0.0.0 10.1.1.2R0(config)# no ip route 2.2.2.2 255.255.255.255 10.1.1.2 track 10R0(config)# no ip route 2.2.2.2 255.255.255.255 10.2.2.2 254R0(config)# endR0# clear ip bgp *R0#02:18:30.743: %BGP-5-ADJCHANGE: neighbor 2.2.2.2 Down User reset02:19:04.435: %BGP-5-ADJCHANGE: neighbor 2.2.2.2 UpR0# show ip cef 2.2.2.20.0.0.0/0, version 20, epoch 0, cached adjacency 10.1.1.20 packets, 0 bytes via 10.1.1.2, 1 dependency, recursive next hop 10.1.1.2, FastEthernet0/0 via 10.1.1.2/32 valid cached adjacencyR0# show ip bgp | begin Network Network Next Hop Metric LocPrf Weight Path*> 192.168.2.0 2.2.2.2 0 0 200 i