GRE - Recursive routing error - AD solution

One of the solutions to the GRE - Recursive routing error is to make sure the AD of the tunnel destination IP address through the tunnel is higher (worse) than what you have in the routing table, thus the router will not choose the tunnel itself as the path to reach the tunnel endpoint:

recursive-routing-gre-topology.png

Based on this topology, the following configurations would resolve the issue assuming we are using RIP:

R1 Configuration:

interface Tunnel0 ip address 192.168.13.1 255.255.255.0 tunnel source 1.1.1.1 tunnel destination 3.3.3.3 router rip version 2 network 1.1.1.1 network 192.168.12.0 network 192.168.13.0 no auto-summary distance 150 192.168.13.1 0.0.0.0

Here, we've set the AD for routes learned via the tunnel interface on R1 to 150. The command distance 150 192.168.13.1 0.0.0.0 tells RIP on R1 to assign an AD of 150 for any routes learned through the interface with IP 192.168.13.1 (the tunnel interface).

R3 Configuration:

interface Tunnel0 ip address 192.168.13.3 255.255.255.0 tunnel source 3.3.3.3 tunnel destination 1.1.1.1 router rip version 2 network 3.3.3.3 network 192.168.23.0 network 192.168.13.0 no auto-summary distance 150 192.168.13.3 0.0.0.0

Similarly, on R3, we've set the AD for routes learned via the tunnel interface to 150.

By adjusting the AD for routes learned through the GRE tunnel, we can ensure that R1 and R3 prefer routes learned through their direct links to R2, rather than those learned through the GRE tunnel.

Links:

https://forum.networklessons.com/t/gre-tunnel-recursive-routing-error/998/58?u=lagapides

https://networklessons.com/cisco/ccie-routing-switching/gre-tunnel-recursive-routing-error