MikroTik CHR: Basic system protection (+ video)
Nine RouterOS steps to lock down a new MikroTik CHR: passwords, services, firewall rules, SSH keys and encrypted backups.
A CHR sits on the public internet from the minute it boots, with no ISP modem in front of it. Scanners and brute-force bots tend to find it within minutes, so do this before anything else. None of it takes deep networking knowledge, and it all applies to physical MikroTik routers, access points and switches running RouterOS too.
Each step shows the WinBox screens with matching RouterOS CLI command underneath.
Here is a short video walkthrough of the main steps:
Table of Contents
- 1. Change the default password and create a new admin user
- 2. Keep RouterOS updated
- 3. Disable unused services and change default ports
- 4. Add firewall filter rules
- 5. Turn off neighbor discovery and MAC services
- 6. Block brute-force attempts with dynamic address lists
- 7. Switch SSH to key authentication
- 8. Disable IPv6 if you do not use it
- 9. Encrypt your configuration backups
The first time you log in with the default credentials, RouterOS asks you to change the password. Don't dismiss it. Most CHR images ship with an empty password on the admin account, and automated scanners will try that within minutes of the router coming online. Newer physical MikroTik hardware has a unique password printed on a label, but that doesn't apply to a CHR.
If the old password was empty, leave that field blank, type the new password twice and click Change now. The new password applies from the next login, including the built-in terminal.

Better still, create a new user with a different name and delete admin altogether. Every brute-force tool tries admin first because it's the public RouterOS default, so removing it closes a whole attack route. Go to System > Users, click New and fill in the username, password and group. The group has to be full or you lose complete management access.
You can also set allowed IP ranges for remote access on the user itself. If you get a range wrong, you can still get in locally, through the VNC console on a CHR or a console cable on hardware, so it's a safe extra layer.

Once the new account works, remove the old default user. In WinBox, select it in the list and click Remove.
admin. If you lock yourself out of a CHR, you will need to rebuild it, or perform a reset, if you use physical device.
From the CLI, run user print to list the accounts and note the ID of the old admin, then run user remove 0, replacing 0 with the ID from the print output.
RouterOS has security holes like any other operating system. MikroTik patches them in regular releases, so an old version means running with publicly known vulnerabilities. Updates also bring stability fixes and new features, which makes staying current an easy win.
Open System > Packages and click Check for Updates. The window shows your current version, what's available and a changelog. For most setups the Stable channel is the right pick. If you want a slower cadence with only well-tested releases, use Long-term.

After the download, the CHR reboots to apply the update. On all CHRs, updates need an active Free or paid CHR license(trials within the 60-day window also can update). Our Licensed and Dedicated CHR plans include a P1 license, so you can take full advantage of the plan's speed.
RouterOS exposes several management services out of the box: WinBox, WebFig, SSH, Telnet, FTP, and plain and SSL versions of the API. Every running service is a possible way in, so if you don't use it, turn it off.
BGOCloud CHRs ship with only WinBox and HTTP (WebFig) enabled, which is a sensible baseline. If you manage the router in WinBox only, you can disable WebFig too. If you need SSH, enable it, change the port, and disable the rest. Go to IP > Services, select the services to turn off and click Disable.

tool bandwidth-server set enabled=no
The second command turns off the built-in bandwidth test server. It's on by default and isn't listed under IP > Services, so it's easy to miss. In WinBox, find it under Tools > BTest Server, untick Enabled and click OK.

For the services you keep, move them off their default ports. Bots scan well-known ports around the clock, and SSH on port 22 and WinBox on 8291 collect constant noise. A high, non-standard port won't stop someone who runs a full port scan, but it removes the bulk of opportunistic attempts. Pick a random number that doesn't clash with reserved ports; the Wikipedia port numbers list is handy for checking what's taken.
In this example, SSH moves to port 27482:

This is where the real protection happens. A well-built firewall drops everything you haven't explicitly allowed, whatever ports your services use. It's the most powerful lockdown tool RouterOS gives you, so get it right before the router goes to work.
Before you touch any firewall settings, turn on Safe Mode. It's the switch in the upper right corner of WinBox (upper left in WinBox v3), or press Ctrl + X in the CLI. If your connection drops, because a bad rule just cut off your management traffic, Safe Mode reverts every change from the session. Once you've confirmed everything works, turn Safe Mode off to save the changes for good.

4a. Chain input: protect the router itself
Input chain rules control traffic going to the router itself: management connections, DNS queries and so on. The logic is simple: allow only what you need and drop everything else. Add rules under IP > Firewall > Filter Rules > New, setting chain, protocol, ports and action for each, and give every rule a comment so the list stays readable.
This setup uses these rules:
- Accept established connections
- Accept related connections
- Allow ICMP ping
- Allow WinBox on TCP port 8291
- Allow SSH on TCP port 27482
- Allow DNS queries from trusted networks on UDP port 53 (optional)
- Drop everything else
Take the WinBox rule as an example: set Chain to input, Protocol to tcp, Dst. Port to 8291 and Action to accept.

Don't leave management open to the whole internet if you can avoid it. The rules below allow WinBox and SSH from anywhere so the example works for every setup, but this is the first thing to tighten. Management services do get vulnerabilities. Limit the rules to your own IP or network in the Src. Address field. Better still, manage the CHR through a VPN such as WireGuard and allow the management ports only from the VPN subnet. In the CLI, add src-address=XX.XX.XX.XX/XX to any rule you want to scope to a network. For BGOcloud CHRs, keep the VNC console in mind as your way back in if your own IP ever changes.
Here's the full set of basic input rules. Adjust the ports to match Step 3. Order matters, because RouterOS reads rules from top to bottom: established and related connections are accepted first, and the drop rule always goes last.
ip firewall filter add action=accept chain=input comment="Accept related connections" connection-state=related
ip firewall filter add action=accept chain=input comment="Allow ICMP ping" protocol=icmp
ip firewall filter add action=accept chain=input comment="Allow WinBox" dst-port=8291 protocol=tcp
ip firewall filter add action=accept chain=input comment="Allow SSH" dst-port=27482 protocol=tcp
ip firewall filter add action=accept chain=input comment="Allow DNS for trusted network" dst-port=53 protocol=udp src-address=192.168.99.0/24
ip firewall filter add action=drop chain=input comment="Drop everything else"
src-address to your real trusted subnet and make sure Allow Remote Requests is on under IP > DNS. Because only that subnet is accepted and the last rule drops the rest, the public internet can't use your CHR as an open DNS resolver, which keeps it out of DNS amplification attacks.4b. Chain forward: drop invalid transit traffic
The forward chain handles traffic passing through the CHR rather than to it. What you need there depends on what you run: a VPN server, BGP, routing for networks behind the router. One rule belongs on every CHR regardless: drop invalid connection states. Invalid packets are often part of scanning and fingerprinting, and there's no legitimate reason to forward them.
Set Chain to forward, scroll down to Connection State, click the + and mark Invalid, then set Action to drop.

When you're done, the filter list should look something like this:

RouterOS runs MikroTik Neighbor Discovery (MNDP) by default. On your internal interfaces that's useful, because it's how The Dude and other tools find devices on a local network. On a public interface it's harmful: it broadcasts your device model, RouterOS version, MAC address and identity to anyone in reach, which is a free asset inventory for an attacker.
RouterOS also runs a MAC Telnet server and a MAC WinBox server. They allow management at Layer 2 without an IP address, which makes sense on a local network and has no business being active on a public interface.
To turn off neighbor discovery, open IP > Neighbors, then Discovery Settings, and set Interface to none. Click OK. The CLI calls this setting discover-interface-list.

For the MAC services, go to Tools > MAC Server and open MAC Telnet Server and MAC WinBox Server. In each window, set Allowed Interface List to none and click OK.

tool mac-server set allowed-interface-list=none
tool mac-server mac-winbox set allowed-interface-list=none
Even on a non-standard port, brute-force tools will eventually find your SSH or WinBox service and start guessing passwords. RouterOS can spot these connection floods and block the source IP for a set time, with no external scripts or software.
The trick chains a few firewall rules. Every new connection to the management ports moves the source address one stage up a short-lived list (stage 1, 2, 3), and a source that keeps opening new connections within a minute lands on a blocklist that's dropped for 24 hours. A normal login needs one or two connections, so legitimate users never notice, while bots hammering the port are blocked after a few attempts. These rules go at the top of the input chain, before your accept rules, so they're evaluated first.
If you already limit WinBox and SSH to specific source addresses (see Step 4), you can skip this step. It matters most when management has to stay reachable from anywhere.
The example covers WinBox on port 8291 and SSH on port 27482. Adjust the ports to your setup. You can further customize the brute force protection, by making more stage lists and rules for more attempts, and by changing the address list timeout for customizing the lockout period.
ip firewall filter add chain=input protocol=tcp dst-port=8291,27482 connection-state=new src-address-list=bf-stage1 action=add-src-to-address-list address-list=bf-stage2 address-list-timeout=1m comment="Brute-force - stage 2" place-before=0
ip firewall filter add chain=input protocol=tcp dst-port=8291,27482 connection-state=new src-address-list=bf-stage2 action=add-src-to-address-list address-list=bf-stage3 address-list-timeout=1m comment="Brute-force - stage 3" place-before=0
ip firewall filter add chain=input protocol=tcp dst-port=8291,27482 connection-state=new src-address-list=bf-stage3 action=add-src-to-address-list address-list=bf-blacklist address-list-timeout=24h comment="Brute-force - blacklist" place-before=0
ip firewall filter add chain=input src-address-list=bf-blacklist action=drop comment="Brute-force - drop" place-before=0
ip firewall filter print after each rule, or enter them in reverse order if you stay in the same console session. Use ip firewall filter print to verify the order of the rules before continuing with the management of the device.In the end, the rules should be shown in reverse begining from the drop rule for the blacklist, up to the rule for adding the address to stage one. 
You can see and manage the blocked addresses at any time under IP > Firewall > Address Lists. Remove an entry there if a legitimate address gets caught. If you lock yourself out, use the VNC console to remove your address from the list.
If you manage the CHR over SSH, switching from passwords to key authentication is one of the best changes you can make. A key pair is practically impossible to brute-force, and if a key is ever compromised you can revoke it without changing credentials on every other system.
Generate an RSA or Ed25519 key pair on your management computer if you don't have one yet. If you protect the private key with a passphrase, the passphrase stays on your computer. The router only ever gets the public key, the file ending in .pub.
Upload the public key to the router through Files in WinBox (or with SCP), then import it. In WinBox, open System > Users, switch to the SSH Keys tab and click Import SSH Key. Choose the user and the key file. The Info field is an optional label that shows up in the key list, so something like the computer's name works well, if nothing is entered, it fills it up with the authorised user.. Click Import SSH Key to finish.

The same thing from the CLI:
Check that key login works from your management computer before you do anything else. Once it does, you can rely on keys for SSH and take password logins off the table for that account.
While you're in the SSH settings, turn on strong crypto. It forces stronger encryption and HMAC algorithms, uses bigger Diffie-Hellman primes and rejects the weaker ones. Any current SSH client supports it, but very old clients may fail to connect. In WinBox, open IP > SSH, tick Strong Crypto and click OK.

yes-if-no-key by default. With that value, a user who has an imported public key can only log in with the key, but users without a key can still use a password. On RouterOS v7 you can close that gap for everyone by setting the field to no, or from the CLI with ip ssh set password-authentication=no. Only do this after you've confirmed that key login works, or you'll be recovering SSH access through alternative management options like Winbox or Webfig, or via the VNC console.This one catches a lot of people out. Most security guides, including the firewall section above, deal only with IPv4. But RouterOS has IPv6 enabled by default, and depending on the hosting network a CHR may get a publicly routable IPv6 address automatically. Without IPv6 firewall rules, that's a second, unguarded way in sitting next to the IPv4 rules you just built.
If you don't use IPv6, the simplest fix is to disable it. In WinBox, open IPv6 > Settings, tick Disable IPv6 and click OK.

A RouterOS backup holds everything: your whole configuration and, depending on the export format, VPN secrets and credentials. An unencrypted backup on a network share, USB drive or cloud bucket is a real exposure if it ends up in the wrong hands. It's easy to overlook and easy to fix.
When you save a backup, always set a password. In WinBox, open Files and click Backup. In the Backup Config window, enter a name and a password and check that Encryption is set to aes-sha256. Leave Don't Encrypt unticked. Click Backup Config. The password in the screenshot is only an example, so use a strong one of your own.

The CLI version:
Store the backup password somewhere other than the backup file. If both sit in the same place and that place is compromised, the encryption is worthless.
Looking for a MikroTik CHR to deploy this on? BGOCloud's MikroTik VPS plans give you a fully licensed RouterOS instance up and running in under a minute, with WinBox and WebFig access from day one and only the ports you actually need open out of the box.
You can also browse our full MikroTik CHR knowledge base for more guides on getting the most out of your router.