lunes, 18 de abril de 2022

Mikrotik change vlan interface

:local fromif "PC-CAPE FO"
:local toif "sfp2"

:global interfaces [/interface vlan find ];
:foreach interface in=$interfaces do={
    :put ("Interface name: " . [/interface get $interface name])
    if ([/interface vlan get $interface interface]=fromif) do={
        :put ("Interface interface: " . [/interface vlan get $interface interface])
        :put "cambio"
        /interface vlan set [/interface get $interface name]  interface=$toif
 }
}