dynamic ipsec mode-config configuration

Well, summarizing everything :slight_smile: The combination of modified “shield” policy and adding “exclusion” rule to srcnat (or removing masquerade at all):

/ip ipsec policy:
0 src-address=0.0.0.0/0 src-port=any dst-address=192.168.56.0/24 dst-port=any protocol=all action=none
/ip firewall nat:
1 chain=srcnat action=accept src-address=192.168.56.0/24 comment=“exclusion rule”
2 chain=srcnat action=masquerade out-interface=ether1

makes it working (incl even BGP) until IPSec is active. As soon as IPSec became inactive, “exclusion” rule prevents LAN to access Internet (thanks to exclusion rule).

To be frank, this is unsatisfactory result. Probably, it can be automated in some ways e.g. add exclusion rule upon IPSec establishing and remove it upon IPSec disconnection, but the more components that can fail, the greater the probability of failure.

Is there something I missed?

Yeah, RouterOS needs VTI. Topic started more than 8 years ago - Feature Request: IPSEC Improvements - and no VTI since then.

I think, we need to consider other options e.g. OpenWRT.

Thank you.