Running scripts/commands on dynamic interfaces

Hello,

I’m not new to mikrotik, but i have only limited ideas to implement the following:
I have a VPN concentrator running Mikrotik and several VPN clients (also Mikrotik) using OpenVPN.
I want to set-up queue-tree prioritization for different kind of traffic go thru the VPN channel.
(like prio1 for voip, prio 3 for RDP, prio5 for internet packets, prio8 for everything else)

Everything is OK, if i configure it manually, but if VPN dropped and reconnected, this dynamic interface
disappears, the rule says parent=unknown.

I tought i can workaround this with netwatch, but most site has two different connection, so backup comes in immediately,
so netwatch don’t detect down.

Another idea is checking OpenVPN session’s uptime somehow, and start script one time it connects.

I would be pleased for any idea! Also, if you let me know, how to remove those lines with parent=unknown would be nice! :slight_smile:

Thanks!

You could switch to using static interfaces by creating OVPN-Client interfaces for each of your VPN clients. That way, interfaces will not disappear on you. Alternately, you’ll need to run a script periodically which looks for the “parent=unknown” and fixes it.

For example, if you added a comment to the queue where the comment was the name of the interface to which the queue should be attached:

/queue tree
:foreach i in=[find where parent~"\\*[0-9a-fA-F]+"] do={
   set $i parent=[get $i comment]
}

Really, I’d use suggest static interfaces as you sound like you have a static set of clients. Also, fair warning, I didn’t test that code.

Really, I’d use suggest static interfaces as you sound like you have a static set of clients. Also, fair warning, I didn’t test that code.[/quote]

Sadly, the code is not working, even

find where parent~"\\*[0-9a-fA-F]+"

not displays anything, but converting dynamic interfaces to static is a really good idea, thanks for it.
(i just need to copy the dynaminc interface, give a proper name, and re-connect the client)
Thanks so much!