Hello,
I hope you are well.
I have a rather simple redundant IPsec tunnel setup to one of the major cloud providers (which implies it likely works on their side). You setup one tunnel on their side and they provide two endpoints for redundancy with different secrets. That is to say, there is nothing than you can change for one endpoint different from the other except secret.
So unless there are differences on your side between the endpoints, it should just work. But it does not.
Both endpoints can never connect at the same time. One connects flawlessly, and then the log is filled every 10 seconds with messages about the other one
ipsec,error failed to get proposal from first template
ipsec,info killing ike2 SA: peer2 [my ip][4500]-[address2][4500] [hash1]:[hash2]
What is interesting is that it does not matter which endpoint is the other one. If you disable the first endpoint, second connects flawlessly, then you reenable the first one - and now it produces these messages. You then disable the second endpoint, first endpoint immediately connects flawlessly, you reenable the second one - and now it produces these messages. In other words both of them work, just not at the same time.
My config relevant to IPsec is as follows (RouterOS 7.18.1)
/ip ipsec profile add dh-group=ecp384 enc-algorithm=aes-256 hash-algorithm=sha384 lifetime=8h name=profile-phase1 prf-algorithm=auto
/ip ipsec peer add address=[address1] exchange-mode=ike2 name=peer1 profile=profile-phase1
/ip ipsec peer add address=[address2] exchange-mode=ike2 name=peer2 profile=profile-phase1
/ip ipsec proposal set [ find default=yes ] disabled=yes
/ip ipsec proposal add auth-algorithms="" enc-algorithms=aes-256-gcm lifetime=1h name=proposal-phase2 pfs-group=modp1536
/ip ipsec identity add auth-method=pre-shared-key peer=peer1 secret=[secret1]
/ip ipsec identity add auth-method=pre-shared-key peer=peer2 secret=[secret2]
/ip ipsec policy set 0 disabled=yes
/ip ipsec policy add action=encrypt dst-address=10.0.0.0/24 ipsec-protocols=esp level=require peer=peer1 proposal=proposal-phase2 src-address=192.168.0.0/24 tunnel=yes
/ip ipsec policy add action=encrypt dst-address=10.0.0.0/24 ipsec-protocols=esp level=require peer=peer2 proposal=proposal-phase2 src-address=192.168.0.0/24 tunnel=yes
/ip firewall address-list add address=[address1] comment=peer1 list=tunnel
/ip firewall address-list add address=[address2] comment=peer2 list=tunnel
/ip firewall filter add action=accept chain=input comment=established,related connection-state=established,related
/ip firewall filter add action=drop chain=input comment=invalid connection-state=invalid
/ip firewall filter add action=accept chain=input comment="wan new IPsec AH" connection-state=new in-interface=wan1 protocol=ipsec-ah src-address-list=tunnel
/ip firewall filter add action=accept chain=input comment="wan new IPsec ESP" connection-state=new in-interface=wan1 protocol=ipsec-esp src-address-list=tunnel
/ip firewall nat add action=masquerade chain=srcnat ipsec-policy=out,none out-interface=wan1
I might be missing something, however, I’ve examined the config several times over and for the life of me cannot see anything wrong with it. What nudges me to believe this is a bug is that I found a similar problem reported by someone else a year ago on Reddit (the OP reports different problem with similar config when on virtual machine but in the comment they implemented the config on Mikrotik hardware and got the same errors I get).
Also, the log messages imply that ROS is trying to access the disabled default proposal template instead of the explicitly stated proposal-phase2 entry… which does not sound good as well.
Could you kindly help me understand if I’m missing anything, please?
P.S. While debugging, I tried to create a separate profile profile-phase1-peer2 and proposal proposal-phase2-peer2 just for the second peer, and reassign the second peer/policy to them, hoping it would lead to them not trying to reach the disabled proposal template. Nothing changed.