Skip to content

Instantly share code, notes, and snippets.

@zayigo
Created April 7, 2024 13:48
Show Gist options
  • Save zayigo/4c16982f6f29d4b56418e39343e29743 to your computer and use it in GitHub Desktop.
Save zayigo/4c16982f6f29d4b56418e39343e29743 to your computer and use it in GitHub Desktop.
MikroTik RouterOS Script: Sync Comments from Interfaces to Bridge Ports

MikroTik Interface-to-Bridge Port Comment Sync Script

This script is designed for use on MikroTik routers running RouterOS. It automates the process of synchronizing comments from interfaces to their corresponding bridge ports which imho should be the default behaviour.

Script

You can copy and paste it in the terminal or use it as a scheduled task.

:foreach int in=[/interface find] do={
    :local intfName [/interface get $int name];
    :local intfComment [/interface get $int comment];
    :if ($intfComment != "") do={
        :local bpId [/interface bridge port find interface=$intfName];
        :if ($bpId != "") do={
            /interface bridge port set $bpId comment=$intfComment
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment