@rextended: Interesting enough, the script works but with a flaw that doesn’t come from itself. The interface gets a second IP assigned through IPSec. Now I’m not sure why my VPN Tunnels do that since I am running two and only one is being created by the policies. But if I delete that second address, the script works.
Now to the million dollar question: How do I modify the script so it not only looks for the address on my wan1 interface but also the right one of the two? I tried to combine the statement using AND but get a syntax error in the terminal. Any ideas? I suppose the following line has to be modified:
:local ip4new [/ip address get [/ip address find interface=$wanif] address]
and this doesn’t do the trick:
:local ip4new [/ip address get [/ip address find interface=$wanif and address!=10.6.*] address][/code