In the example above, R1:
R1(config)# interface Tunnel0 R1(config-if)# ip address 172.16.0.1 255.255.255.0 R1(config-if)# tunnel source 184.108.40.206 R1(config-if)# tunnel destination 220.127.116.11
R2(config)# interface Tunnel0 R2(config-if)# ip address 172.16.0.2 255.255.255.0 R2(config-if)# tunnel source 18.104.22.168 R2(config-if)# tunnel destination 22.214.171.124
When a packet with dst IP
172.16.0.2 address arrives to R1, how does R1 know where to send it? It checks its routing table and knows that
172.16.0.2 is directly connected? Anyway, it adds new IP header (dst IP set to
126.96.36.199 -tunnel destination) and GRE header to that packet.
When R2 receives the packet, it knows the packet was addressed to its
188.8.131.52 FE0/1 interface and it matches the tunnel source IP address that was set up on R2. So it removes the outer IP and GRE header, leaving the packet with dst IP
172.16.0.2 and routes it forward (not in this case of course, but it would if the dst IP was different).
Suppose there was another router - R3. Is it possible to set up a tunnel between R1 and R3 using the same network -
When R1 pings the tunnel interface of R2 -
172.16.0.2, how does it know how to send it there? It probably checks his own Tunnel0 configuration: oh, I should send it to
172.16.0.2, which is in the same subnet as my Tunnel0 interface
172.16.0.1. Then it checks
tunnel destination address to learn it's
184.108.40.206. In other words, it can't directly ARP
172.16.0.2 because it's not a physical connection.
Let's say I add R3 with Tunnel1 interface
172.16.0.4/24 whose public IP is
220.127.116.11. Next I configure Tunnel1 on R1:
R1(config)# interface Tunnel1 R1(config-if)# ip address 172.16.0.3 255.255.255.0 R1(config-if)# tunnel source 18.104.22.168 R1(config-if)# tunnel destination 22.214.171.124
Pinging 172.16.0.2 from R1 probably wouldn't work, because now I have two tunnels on R1 using the same subnet (R1-R2 and R1-R3). R1 has no idea which tunnel I mean here and therefore it doesn't know the tunnel destination.
TLDR Does it mean we need a different subnet for each tunnel? If so, shouldn't all tunnel subnets be /30? We only need two IPs for a tunnel - source and destination.