Skip to content

MikroTik setup

This page shows the MikroTik settings needed to work with Farava. First register the router in the panel so you have the server address and shared secret. Each step is shown in WinBox and as a terminal command. The panel also builds the first command for you: on the router’s page, the RouterOS command card has Copy command.

In WinBox, go to Radius and add a new entry:

WinBox field Value
Service ppp (and hotspot for Hotspot)
Address An address of the Farava server that the router can reach (the Main address, or one of the Other server addresses, from the NAS registration page). Use the address the server itself uses to reach this router.
Secret The same shared secret registered in Farava
Authentication Port 1812
Accounting Port 1813
Src. Address The same RADIUS source IP you registered in Farava
/radius add service=ppp address=FARAVA_SERVER_IP secret="SHARED_SECRET" \
authentication-port=1812 accounting-port=1813 src-address=NAS_SOURCE_IP

The ports are fixed: Farava receives sign-in on UDP 1812 and accounting on UDP 1813, so the router must use these values. If the router is set up with a different server address from the one the server uses to reach it, sign-in can still work while disconnect and plan-change requests are dropped. If your RouterOS version refuses src-address, leave it out and set the source address in the router’s RADIUS settings instead.

In PPP → Secrets → PPP Authentication&Accounting (or PPP → AAA):

  • turn on Use Radius;
  • turn on Accounting;
  • set Interim Update to 5m.
/ppp aaa set use-radius=yes accounting=yes interim-update=5m

Also make sure there is no local PPP Secret on the router for the subscriber’s username; otherwise the router answers by itself and never asks Farava.

For suspension and quota exhaustion to close an active session, the router must accept Disconnect/CoA requests from Farava.

In WinBox: Radius → Incoming, turn on Accept and set Port to 3799.

/radius incoming set accept=yes port=3799

Enter the same port in Farava under the router’s Advanced settings as the CoA / Disconnect port, and turn on Supports session disconnect.

In IP → Firewall → Filter Rules, add a rule in the input chain before the general drop rule so port 3799 is open only to the Farava server (the address it uses to reach this router):

/ip firewall filter add chain=input action=accept protocol=udp \
src-address=FARAVA_SERVER_IP dst-port=3799 \
comment="Allow Farava RADIUS Disconnect"

Never open port 3799 to the whole internet. If there is NAT between Farava and the router, use the address the router actually sees.

  1. Enable the router in Farava.
  2. Connect with a test subscriber.
  3. See the subscriber online in PPP → Active Connections on the router and in Network → Sessions in Farava.
  4. On the router’s page in Farava, Live RADIUS status should be LIVE.
  5. Suspend the test subscriber’s service and check that they disappear from Active Connections a few seconds later. (This only happens in enforce mode.)
  6. Resume the service.

Farava does not create queues on the router and never connects to the router API. When a subscriber signs in, Farava sends the plan speed in the RADIUS reply and MikroTik itself creates a dynamic queue for that session. See the queues under Queues → Simple Queues or with /queue simple print. If no queue is created, the system is probably still in observe mode.