Correct syntax to disconnect ipsec remote-peer using php api

Hi, I’m trying to use the php api to reset a vpn tunnel.

I can see the connected remote-peer with this:
$mt->write(‘/ip/ipsec/remote-peers/getall’);

I can see the currently installed SAs with this:
$mt->write(‘/ip/ipsec/installed-sa/getall’);

I can flush the currently installed SAs with this:
$mt->write(‘/ip/ipsec/installed-sa/flush’);

But using the following, I can’t seem to disconnect the currently connected remote peer:
$mt->write(‘/ip/ipsec/remote-peers/kill-connections’);

Is there something I’m missing here?
Please help!

Thanks!

That’s odd. I can only assume that’s a bug in RouterOS.
(I don’t use IPsec, so I can’t test this…)

What RouterOS version are you using anyway? Try it with 5.24 if it’s not that.

using RouterOS 5.21

Update: It works if I perform the following in this order:

$mt->write(‘/ip/ipsec/installed-sa/getall’);
$mt->write(‘/ip/ipsec/installed-sa/flush’);
$mt->write(‘/ip/ipsec/remote-peers/kill-connections’);