Pragmatically change ports on Mikrotik RouterOS

I created a simple script, that can help you change ports on your Mikrotik router


How to use

in my script fill array with port aliases:

:global PFVports {http="80";ssh="22";https="443";ftp=23};

add a comment to your NAT rule, that starts with “PFV_” and folows with port alias like that:

Now run my script and it will automatically set dst-port to whatever you set (in script) http port value… in my example port 80.

Next time you need to change some ports, you don’t need to change one by one, just update PFVports array and re-run this script.

Note:

dst-port is just one of many things that can be changed with this script… it can be easily changed to do whatever you need.

Hope you like it :)

No Comments Yet.

Leave a Comment