RouterOS Script to Set Master Port

Created by Faye Admin, Modified on Thu, May 29 at 11:14 AM by Faye Admin

This script will set a series of ports to use one port as their master. Paste the script into a terminal or paste it to a notepad file named .rsc and import it. Edit the variables as described in the script and then run it.

      system script add name="Set Ports" owner=admin policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive source="#\r\    \n#\r\    \n# Set master port\r\    \n# Then set slave port type i.e.: ether or sfp \r\    \n# This is for interfaces not named \93ether\94 like SFP\r\    \n# Then set ports in range form using SlavePortStart and SlavePortStop.\r\    \n:global MasterPort \"ether24\"\r\    \n:global PortType \"ether\"\r\    \n:global SlavePortsStart \"1\"\r\    \n:global SlavePortsStop \"9\"\r\    \n:for i from=\$SlavePortsStart to=\$SlavePortsStop do={\r\    \n/interface ethernet set (\$PortType . \$i) master-port=\$MasterPort\r\    \n}"     

This script will clear any master ports and set all masters to none.

      /system script add name="Clear Ports" owner=admin policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive source=\    "/interface ethernet\r\    \nset [find] master=none"

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article