After beating my head against a software wall (which is much more painful than a stone wall) - I finally got the remote access I needed functioning. However - I refuse to believe that the unholy union of software and setup I brought into being conforms to the will of Cerf & Kahn. So I beseech the prophets of this forum to show me a better path.
The goal: access remote LAN 192.168.42.0/24 via IPSec.
First, I established a IKEv2 connection, with explicit policy template, proposal, peer, identify, mode - all the fun stuff. My primary router is the responder - so the mode config lists the “local” networks that need to access the remote. The local router has IPSec endpoint 10.21.3.1 and the remote is 10.21.3.8.
This worked - just fine. Didn’t need anything else - the primary router NAT rules were predefined, worked with other IPSec clients, and since the “identity” included a “notrack-chain=prerouting” nothing else was needed. If it matters, I will mention that I have no masquerade rules on that router - everything is explicit srcnat. But…I could not come up with any combination of routing definitions or NAT that would allow me to reach 192.168.42.1 from the main router. Googling, googling, googling, fighting, fighting, fighting…
Before I continue - my first question: is it possible to achieve my goal with the above setup (just with the right magic incantation of routing & NAT rules)?
I found a reference to GRE as the possible solution. I’m inferring that of the tunnel options GRE has the least overhead when compared to IPIP or EoIP (and I don’t know if there’s any other comparable choices). So…I tried GRE. Because I had a working IKEv2 connection I chose to use it to transport the GRE. I simply set the remote addresses at each end to the opposing IPSec endpoints - and the tunnel came up.
Next question (if nothing I said above is objectionable): leaving everything else at the defaults the MTU came up at 1398. Do I want to leave it there? Do I change anything else at the GRE level?
Now I added addresses to the GRE of 10.41.0.1 (local) and 10.41.0.2 (remote). And…they can reach each other. I added a route to the remote LAN 192.168.42.0/24 via 10.41.0.2…and the router can see it! Major milestone reached!
But nothing else can. Sigh. Ok…start poking with srcnat. First, on the local router, I set a srcnat with dst-address=10.41.0.0/24 to-address=10.41.0.1. That allows the local network to reach the remote 10.41.0.2…which isn’t really needed but ok. So then I add a srcnat with dst-address=192.168.42.0/24 to-address=10.41.0.1…and I can see packets hitting the remote but not coming back. So then the last item was adding on the remote router a srcnat with dst-address=192.168.42.0/24 to-address 192.168.42.1…and it all works! It works!
But it’s ugly. Incredibly ugly. I have to believe there’s a better way. Please, please, help me to see the light and show me the path to network enlightenment.