In a GRE tunnel, when R1 (public IP 172.16.0.1
, tunnel address 10.0.0.1
) sends a packet to R3 (public IP 172.16.0.6
, tunnel address 10.0.0.2
) and R3 receives it, the following happens:
A packet is received on R3's physical interface.
A routing decision determines that the destination address belongs to R3.
The router recognizes the destination IP address (
172.16.0.6
)and GRE header as belonging to the tunnel interface. The tunnel interface removes the outer IP and GRE headers, and the original IP packet is sent back "in" to the router.A second routing decision is performed based on the original destination IP address.
The IP TTL is decremented by one and the packet is transmitted out the appropriate interface.
See here for the example I'm gonna discuss now and for more details.
I'm wondering about point 3. If the packet's destination in the outer IP header set by the tunnel on R1 is 172.16.0.6
, why doesn't R3 immediately get rid of the extra IP and GRE headers?
Instead, R3 checks its configured tunnels to find one with source tunnel address 172.16.0.6
and passes the packet there.
It means that the destination tunnel address on R1 needs to match the source address on R3, and vice versa (proof by example). If they don't, R1 won't be able ping 10.0.0.2
. What is a logical explanation for this requirement?
Maybe I'd like the packets to take different physical paths over the tunnel, depending on the direction they are travelling (R1 to R3 or R3 to R1)?