I have two machines on different subnet. Say one is 1.1.1.1/8 while the other is 2.2.2.2/8. The two are able to talk through a common router.
The 2.2.2.2 machine has an internal interface on a third local network 176.16.1.1/24. An application is listening on this interface. The router is not aware of the 176.16.x.x subnet.
On the 1.1.1.1 I want to be able to send data to the 176.16.1.1 interface.
I want 1.1.1.1 to generate IP packets with a source=1.1.1.1 and destination=2.2.2.2. The packets should encapsulate another packet with the source 1.1.1.1 and destination 172.16.1.1.
I expect the 2.2.2.2 machine to decapsulate the packet and deliver the internal 1.1.1.1->172.16.1.1 packet to the application. Since 1.1.1.1 is a routable IP, the app can respond with a non-encapsulated standard IP packet.
Any hint on how to do that would be greatly appreciated. Thanks!
Edit
On the 1.1.1.1 I used the following
ip tunnel add ipiptun1 mode ipip local 1.1.1.1 remote 2.2.2.2
ip link set ipiptun1 up
ip addr add 172.16.0.0/16 dev ipiptun1
The above also creates a routing table entry
172.16.0.0/16 dev ipiptun1 proto kernel scope link src 172.16.0.0
And encapsulated packets do arrive at 2.2.2.2 where the inner packet is 172.16.0.0 -> 172.16.1.1.
However, despite 2.2.2.2 having an eth0:103 interface with the 172.16.1.1 address, the data does not arrive at the application. Instead an ICMP unreachable is returned to 1.1.1.1.