Skip to content

MikroTik Configuration

Settings for the MikroTik RouterOS API connection.

Env: MIKROTIK_HOST · Default: — (required)

RouterOS API address in host:port format. There is no built-in default: the bouncer exits with mikrotik.address is required if this value is empty. The 192.168.0.1:8728 used below is the sample value shipped in config/cs-routeros-bouncer.yaml, not a default.

  • 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: — (required)

The RouterOS API username. There is no built-in default: the bouncer exits with mikrotik.username is required if this value is empty. The crowdsec name is the sample value shipped in config/cs-routeros-bouncer.yaml, not a default. 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: — (required)

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. Only needed when the router uses a self-signed certificate.

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

How many RouterOS API sessions the bouncer can use for parallel work such as reconciliation removals. A higher value increases throughput when reconciliation has many stale address-list entries to delete; adds and live decisions always use the main connection, so they are not affected.

  • 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 reconciliation removals

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