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:

1
Change the default password and create a new admin user

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.

MikroTik RouterOS expired password prompt with the change password form shown on first login to a CHR or physical MikroTik device

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.

MikroTik RouterOS System Users window creating a new admin user in the full group with an allowed IP range for remote access

ROUTEROS CLIuser add group=full name=youradmin password=H@rDt0Gu3SsP@sSw0Rd

Once the new account works, remove the old default user. In WinBox, select it in the list and click Remove.

Important: Log in with the new account and check that everything works before you 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.

Removing the default admin user in MikroTik RouterOS, System Users window with the Remove button highlighted

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.


2
Keep RouterOS updated

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.

MikroTik RouterOS System Packages window with the Check For Updates button, showing the current RouterOS version on a CHR and the available updates

Note: Upgrading from RouterOS v6? You can't jump straight to the latest v7 release. First switch the channel to Upgrade, which installs the v7 base build (around v7.12). After the reboot, switch back to Stable and check for updates again to reach the current release.

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.


3
Disable unused services and change default ports

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.

MikroTik RouterOS IP Service List with the unused management services API, API-SSL, Telnet, FTP, WWW and WWW-SSL disabled to reduce the attack surface

ROUTEROS CLIip service disable api,api-ssl,ftp,telnet,www,www-ssl
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.

MikroTik WinBox Tools menu with BTest Server selected and the BTest Server Settings window showing the Enabled checkbox cleared

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:

Changing the SSH service port in MikroTik RouterOS, IP Services window showing the SSH port changed from 22 to a custom non-standard port

ROUTEROS CLIip service set ssh port=27482
Note: WinBox port: you can change the WinBox port (default 8291) too, for added obscurity. Some older WinBox integrations and monitoring tools have the port hardcoded and stop working after a change, so test in your environment before you commit to it.
Note: Service allowlists: every service in IP > Services has an Allowed Address field to restrict which IP ranges may connect. It's a useful extra layer, but it behaves differently from a firewall rule. When a connection arrives from outside the allowlist, RouterOS answers with an empty HTTP response instead of silently dropping the packet, so a scanner can still see that the service is there. Firewall rules (next step) are the stronger tool: they drop packets before any service sees them and don't reveal what's running.

4
Add firewall filter rules

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.

MikroTik WinBox Safe Mode toggle, enabled before making firewall changes so the settings revert automatically if the connection drops

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.

Adding a WinBox accept rule in MikroTik RouterOS IP Firewall Filter Rules with chain input, protocol tcp, destination port 8291 and action 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.

ROUTEROS CLIip firewall filter add action=accept chain=input comment="Accept established connections" connection-state=established
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"
Note: DNS rule: "Allow DNS for trusted network" is optional. Add it only if a specific internal network, such as your VPN clients, should be able to query the CHR for DNS, for example when you run static DNS entries or an adlist on the router. Change 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.

Adding a forward chain drop rule for invalid connections in MikroTik RouterOS, chain forward, connection state invalid, action drop

ROUTEROS CLIip firewall filter add action=drop chain=forward comment="Drop invalid connections" connection-state=invalid

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

MikroTik RouterOS firewall filter rule list with the complete basic security ruleset for a CHR, input accept rules and the drop-everything-else rule

Important: These rules are a starting point, not a finished security policy. They cover a freshly deployed CHR. If you run WireGuard, BGP peers, a DNS resolver or Docker containers, extend the ruleset to match your real traffic, and don't take it to production without reviewing it and using Safe Mode.

5
Turn off neighbor discovery and MAC services

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.

MikroTik WinBox IP menu with Neighbors selected and the Discovery Settings window with the Interface field set to none

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.

MikroTik WinBox Tools menu with MAC Server selected and the MAC Telnet Server and MAC WinBox Server windows with Allowed Interface List set to none

Note: If you're connected to the router by MAC address right now, switching the MAC servers off ends that session. Make sure you can reach the router by IP before you do this.
ROUTEROS CLIip neighbor discovery-settings set discover-interface-list=none
tool mac-server set allowed-interface-list=none
tool mac-server mac-winbox set allowed-interface-list=none

6
Block brute-force attempts with dynamic address lists

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.

ROUTEROS CLI - Place them one by one!ip firewall filter add chain=input protocol=tcp dst-port=8291,27482 connection-state=new action=add-src-to-address-list address-list=bf-stage1 address-list-timeout=1m comment="Brute-force - stage 1" place-before=0
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
Note: Be careful when you place these rules in the terminal, as the RouterOS CLI treats the rule priorities differently. It is recommended to use safe mode when doing so, by activating it with Ctrl+X. Then you may either enter 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. 
MikroTik WinBox firewall, with shown rules for brute force protection. From first rule - Droping the blacklisted address, to the last rule - entering the first list

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.

ROUTEROS CLIip firewall address-list remove [find address=youraddress]

7
Switch SSH to key authentication

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.

MikroTik WinBox System menu with Users selected, the Users window on the SSH Keys tab with Import SSH Key, and the Import SSH Key dialog with user, key file and info filled in

The same thing from the CLI:

ROUTEROS CLIuser ssh-keys import public-key-file=id_rsa.pub user=youradmin

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.

MikroTik WinBox IP menu with SSH selected and the SSH Settings window showing the Strong Crypto checkbox ticked

ROUTEROS CLIip ssh set strong-crypto=yes
Note: Password logins: the same SSH Settings window has a Password Authentication field, set to 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.

8
Disable IPv6 if you do not use it

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.

MikroTik WinBox IPv6 menu with Settings selected and the IPv6 Settings window showing the Disable IPv6 checkbox ticked

ROUTEROS CLIipv6 settings set disable-ipv6=yes

9
Encrypt your configuration backups

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.

MikroTik WinBox Files window with the Backup action and the Backup Config dialog showing a backup name, a password and the aes-sha256 encryption setting

The CLI version:

ROUTEROS CLIsystem backup save name=CHR-backup password=Str0ngP@ssword encryption=aes-sha256

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.

Note: Physical MikroTik devices: unlike a CHR, where a rebuild starts from a clean image, a physical router doesn't wipe its flash when you reset the configuration, whether through System > Reset Configuration or the hardware reset button. Backup files on the device's storage survive the reset. If the device is sold, decommissioned or lost, any unencrypted backup on it is fully readable. Always use encrypted backups and delete the files from the device once you've copied them off.
Important: Security isn't a one-time setup. Revisit your firewall rules and services whenever the CHR changes role, and read the RouterOS release notes for security advisories when updates come out. A router that was hardened at deployment can still drift into exposure, so make a review a habit.

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.

You can enjoy a powerful MikroTik CHR VPS with unlimited traffic. Get the most out of your VPS with our unlimited traffic option.

Get Started!
icon knowledge

Related Articles

MikroTik CHR: How to set-up PPTP VPN Server (+ video)

Setting up a PPTP VPN server on a MikroTik router is one of the fastest ways to get a basic VPN...

Mikrotik CHR: How to fix VPN error in Windows (+ video)

In this article, we will show you how to fix - "A connection to the remote computer could not be...

Connecting your computers to WireGuard VPN hosted in MikroTik

This guide walks you through connecting a Windows, macOS, or Linux computer to a WireGuard VPN...

Connecting Android and IOS to WireGuard VPN hosted in MikroTik

This guide covers connecting your Android or iPhone to a WireGuard VPN server running on a...