run script from terminal – MikroTik RouterOS
this is in fact very simple:
it also has the benefit that the terminal does tell you on which line and column your script is wrong (Winbox does not show that during execution):
Manual:Configuration Management – MikroTik Wiki
When you upload a script over ftp and have it end with auto.rsc, then it is automatically being executed and logged. For instance a file called anything.auto.rsc will have the log written to anything.auto.log.
It is not possible to exit or break a loop statement – MikroTik RouterOS so if you want to break a :for loop early, you have to recode it into a :while loop. You can :return from a function when inside a loop, but that’s not the same (for instance compare C# break versus return or Delphi break versus exit).
:for loops are a strange beast so I will elaborate on those in a separate post.
When switching my DHCP to a Mikrotik CCR1009, both the AP7920 and AP7921 failed to get IP addresses. The APC7921 would look bounce between waiting and offered states like this:
Just one example; it applies to virtually all consumer IoT and routers I know: upgrading is hard especially if it’s undocumented on how to keep your configuration.
Download the one you want to upgrade to. Go to the upgrade menu from the one you already installed. Browse to where you downloaded the one you want to upgrade to and select it. Also make sure you check “erase NVram” and then click upgrade. When it is done, your “user name” and “password” will be “admin”. Then configure by hand/manually to what you want. Hope that helps.
Since neither the matrix nor the PDF contains links to the products, here is a small list of what I could source last year and is compatible with both the CCR1009 routeres and CRS226 switches:
DAC allowing for two-way traffic compatible with both SFP and SFP+:
MikroTik has great hardware, but getting things to work can be a bit ehm intimidating.
So here are some links that were useful getting my CCR1009 and CRS226 configurations to do what I wanted.
Saving your configuration (two possibilities: binary backup file which only works on the same physical model device, or text based configuration export script that you can import back to any model).
Many people like Winbox because they prefer visual configuration. Others like the web or terminal interface better (the terminal is especially useful for scripts)
I had a lot of DHCP entries on my LAN before switching to the MikroTik for which some I wanted to add statically. Couldn’t find out how to do that in the IP pool, but it appeared there is a different way to do it:
the MAC address cab be either (:) separated or minus (-) separated. And yes: there is a RegEx for that.
usually you don’t pass the client-id (it’s here just as an example that you could use it, but most DHCP clients do NOT use a client-ID, as they only use the MAC address)
If you use the MikroTik as a caching DNS server, then you need to enable “/ip dns set allow-remote-requests=yes”, but also immediately disable DNS TCP and UDP on all your WAN ports. See:
If you run your internal DNS servers for the outside world, modify the rules to forward non non-LAN ports; see https://www.youtube.com/watch?v=X-wkLYKYaj8: How to redirect DNS to own DNS server using mikrotik routerboard
Hardening (since my Guest WiFi is outside of the Mikrotik LAN and WAN realm, I’ve left some things open, for instance MAC service is available, but on a limit set of interfaces):
You need to setup both the clock (date/time) and SNTP in one step:
Setup SNTP (Winbox) aka NTP (shell): /system ntp client set enabled=yes server-dns-names=0.pool.ntp.org,1.pool.ntp.org,2.pool.ntp.org,3.pool.ntp.org
After a few seconds the Winbox will update the SNTP Client dialog and a few seconds later, the Clock dialog will also update itself.
Graphing: ensure you only limit this to IP-addresses that you want graphs to be visible on (0.0.0.0/0 makes it visible to ALL): Manual:Tools/Graphing – MikroTik Wiki
DNS – MikroTik RouterOS: I would like to have my router to stop all the DNS coming from my clients and not reaching my ISP provider.
/ip firewall mangle add chain=prerouting action=change-ttl new-ttl=increment:1
very simple solution for a traceroute to Hide ip address – MikroTik RouterOS