MikroTik Configuration
Settings for the RouterOS API connection.
Connection
Section titled “Connection”mikrotik.address Required
Section titled “mikrotik.address ”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.
mikrotik.tls Optional
Section titled “mikrotik.tls ”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: truemikrotik.tls_insecure Optional
Section titled “mikrotik.tls_insecure ”Env: MIKROTIK_TLS_INSECURE · Default: false
Skip TLS certificate verification. Required for self-signed certificates.
Timeouts
Section titled “Timeouts”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.
Connection Pool
Section titled “Connection Pool”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-sessionslimit and automatically reduces the effective pool size so it never exceedsmax-sessions − 2(reserving connections for the main client and external tools such as WinBox).
mikrotik: pool_size: 8 # Higher parallelism for faster bulk operationsChecking the router limit
Section titled “Checking the router limit”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