![]() |
![]() |
RouterOS Scripts a collection of scripts for MikroTik RouterOS |
ℹ️️ Info: This module can not be used on its own but requires the base installation. See main README for details.
This module and its functio are are supposed to handle interfaces and switching them from one bridge to another.
Just install the module:
$ScriptInstallUpdate mod/bridge-port-to;
The configuration goes to ports' comments (/interface/bridge/port).
/interface/bridge/port/add bridge=br-guest comment="default=dhcp-client, alt=br-guest" disabled=yes interface=en1;
/interface/bridge/port/add bridge=br-intern comment="default=br-intern, alt=br-guest" interface=en2;
/interface/bridge/port/add bridge=br-guest comment="default=br-guest, extra=br-extra" interface=en3;
Also dhcp client can be handled:
/ip/dhcp-client/add comment="toggle with bridge port" disabled=no interface=en1;
Add a scheduler to start with default setup on system startup:
$ScriptInstallUpdate global-wait;
/system/scheduler/add name=bridge-port-to on-event="/system/script/run global-wait; :global BridgePortTo; \$BridgePortTo default;" start-time=startup;
The usage examples show what happens with the configuration from above.
Running the function $BridgePortTo with parameter default applies all
configuration given with default=:
$BridgePortTo default;
For the three interfaces we get this configuration:
dhcp-client enables the dhcp client for interface en1. The bridge port entry is disabled.en2 is put in bridge br-intern.en3 is put in bridge br-guest.Running the function $BridgePortTo with parameter alt applies all
configuration given with alt=:
$BridgePortTo alt;
en1 is put in bridge br-guest, dhcp client for the interface is disabled.en2 is put in bridge br-guest.en3 is unchanged, stays in bridge br-guest.Running the function $BridgePortTo with parameter extra applies another
configuration:
$BridgePortTo extra;
en1 and en2 are unchanged.en3 is put in bridge br-intern.⬅️ Go back to main README
⬆️ Go back to top
RouterOS Scripts documentation generated on Thu, 20 Nov 2025 20:47:50 +0100 for main/3287/699be25b
Copyright © 2013-2025 Christian Hesse <mail@eworm.de>