Skip to content

MikroTik Configuration

Settings for the RouterOS API connection.

Env: MIKROTIK_HOST · Default: 192.168.0.1:8728

RouterOS API address in host:port format.

  • Port 8728 — plaintext API
  • Port 8729 — TLS-encrypted API
mikrotik:
address: "192.168.0.1:8728"

mikrotik.username Required

Section titled “mikrotik.username ”

Env: MIKROTIK_USER · Default: crowdsec

The RouterOS API username. Use a dedicated user with minimal permissions. See Router Setup for creating the user.

mikrotik.password Required

Section titled “mikrotik.password ”

Env: MIKROTIK_PASS · Default:

The RouterOS API password.

Env: MIKROTIK_TLS · Default: false

Enable TLS for the RouterOS API connection. Requires the api-ssl service on the router (port 8729).

mikrotik:
address: "192.168.0.1:8729"
tls: true

mikrotik.tls_insecure Optional

Section titled “mikrotik.tls_insecure ”

Env: MIKROTIK_TLS_INSECURE · Default: false

Skip TLS certificate verification. Required for self-signed certificates.

mikrotik.connection_timeout Optional

Section titled “mikrotik.connection_timeout ”

Env: MIKROTIK_CONN_TIMEOUT · Default: 10s

Maximum time to wait for the initial API connection. Uses Go duration format.

mikrotik.command_timeout Optional

Section titled “mikrotik.command_timeout ”

Env: MIKROTIK_CMD_TIMEOUT · Default: 30s

Maximum time to wait for a single API command to complete. Increase if you have a slow router or large address lists.

mikrotik.pool_size Optional

Section titled “mikrotik.pool_size ”

Env: MIKROTIK_POOL_SIZE · Default: 4

Number of parallel RouterOS API connections used for bulk operations (adding, removing, and reconciling address-list entries). A higher value increases throughput during startup reconciliation and mass ban/unban events.

  • Valid range: 1–20
  • Auto-capping: On startup the bouncer queries the router’s API service max-sessions limit and automatically reduces the effective pool size so it never exceeds max-sessions − 2 (reserving connections for the main client and external tools such as WinBox).
mikrotik:
pool_size: 8 # Higher parallelism for faster bulk operations

The RouterOS API service has a max-sessions setting that limits simultaneous connections. The factory default is 20.

# Check current limit
/ip/service/print where name=api
# Increase it (maximum supported value is 1000)
/ip/service/set api max-sessions=1000