← Back to Blog

MikroTik RADIUS Server Setup for PPPoE and DHCP: Commands, Attributes and Best Practices

RADIUS is where a commercial decision ("this customer has paid and is on the 200/20 plan") becomes network reality. On a MikroTik network the setup itself is not hard, but the details people skip are the ones that wake you up at 3 a.m. This guide walks through a complete MikroTik RADIUS configuration for ISPs and WISPs on RouterOS v7: the RADIUS client, PPPoE and DHCP/IPoE authentication, accounting, the attributes that control speed and IP addressing, Change of Authorization (CoA) for plan changes without disconnecting, soft suspension, redundancy and troubleshooting.

Quick summary

  • Add the RADIUS server under /radius with a unique secret per router and the services ppp,dhcp.
  • Enable /ppp aaa use-radius=yes accounting=yes interim-update=5m.
  • Enable /radius incoming accept=yes so the server can send CoA and Disconnect messages.
  • Send speed with Mikrotik-Rate-Limit and the IP with Framed-IP-Address or Framed-Pool.
  • Run two RADIUS servers and never set speeds locally on the router.

How RADIUS fits into a MikroTik ISP network

The MikroTik router acting as PPPoE server or DHCP server is the NAS (Network Access Server), often called the BNG. It terminates subscriber sessions and asks the RADIUS server two questions:

  • Authentication and authorization: is this subscriber allowed on, and with which parameters (speed, IP or pool, address list, IPv6 prefix)?
  • Accounting: what did the session use and how long was it connected (Start, Interim-Update and Stop records)?

The rule that keeps the network clean is one source of truth. The subscriber's speed and status come from RADIUS, which reads them from your billing database. They are not typed by hand into a PPP secret or a simple queue on the router. If someone can "fix" a speed locally, they will, and billing will disagree with the network for years.

The usual ports are UDP 1812 for authentication, UDP 1813 for accounting and UDP 3799 for CoA/Disconnect messages sent from the server to the router.

Step 1: Configure the RADIUS client on the MikroTik

Add your RADIUS server once per router. Use a different shared secret on every router, and set src-address to the IP the server expects. A router with several interfaces otherwise sends requests from whichever address it routes through, and the server silently drops them.

/radius
add address=10.0.0.10 secret="unique-secret-bng1" service=ppp,dhcp \
    src-address=10.0.0.1 authentication-port=1812 accounting-port=1813 timeout=3s
add address=10.0.0.11 secret="unique-secret-bng1" service=ppp,dhcp \
    src-address=10.0.0.1 authentication-port=1812 accounting-port=1813 timeout=3s

/radius incoming
set accept=yes port=3799

The second entry is your backup server. RouterOS tries the servers in order, so a maintenance window on the primary no longer means "no new connections anywhere". /radius incoming accept=yes is what allows the server to change speeds and disconnect sessions later, so turn it on from day one.

Step 2: PPPoE authentication with RADIUS

Create a neutral PPP profile and let RADIUS fill in everything that differs per subscriber. Then tell PPP to use RADIUS for authentication and accounting.

/ip pool
add name=pool-cgnat ranges=100.64.0.10-100.64.31.254

/ppp profile
add name=radius-default local-address=100.64.0.1 remote-address=pool-cgnat \
    dns-server=1.1.1.1,9.9.9.9 change-tcp-mss=yes only-one=yes use-upnp=no

/ppp aaa
set use-radius=yes accounting=yes interim-update=5m

/interface pppoe-server server
add service-name=isp interface=vlan100-access default-profile=radius-default \
    authentication=pap,chap,mschap2 one-session-per-host=yes keepalive-timeout=30 disabled=no

A few choices matter here:

  • interim-update of 5 to 10 minutes is the right balance. Too short loads the accounting database for no benefit across thousands of sessions; too long leaves "ghost" sessions after a power cut and makes volume billing inaccurate.
  • only-one=yes and one-session-per-host=yes stop the same credentials being used from two places.
  • Keep local PPP secrets empty. RouterOS checks local secrets before RADIUS, so a forgotten test secret silently overrides your billing.

Step 3: DHCP / IPoE authentication with RADIUS

On fiber and on modern WISP designs many providers drop PPPoE and use DHCP (IPoE). The same RADIUS server authorizes the DHCP lease: the MikroTik sends the client MAC address (and, behind a relay, Option 82 circuit and remote IDs), and the server answers with the IP, speed and address list.

/ip dhcp-server
add name=dhcp-ipoe interface=vlan200-ipoe address-pool=pool-ipoe lease-time=30m \
    use-radius=accounting disabled=no

/ip dhcp-server network
add address=100.65.0.0/20 gateway=100.65.0.1 dns-server=1.1.1.1,9.9.9.9

With use-radius=accounting the router authorizes each lease through RADIUS and also sends accounting, so you see IPoE subscribers online just like PPPoE ones. The trade-off is that identity is based on MAC or port, so your CPE inventory has to be accurate. If a customer replaces their router and the MAC is the only identifier, that becomes a support call. Option 82 (port-based identity) avoids it on switched access networks.

Step 4: The MikroTik RADIUS attributes that do the work

These are the attributes an ISP actually uses day to day. MikroTik-specific ones come from the MikroTik dictionary (vendor ID 14988), which FreeRADIUS and most billing platforms already include.

AttributeWhat it doesExample value
Mikrotik-Rate-LimitUpload/download speed, with optional burst, priority and minimum rate20M/200M 30M/300M 20M/200M 30/30 8
Framed-IP-AddressStatic public or private IPv4 for this subscriber185.10.20.30
Framed-PoolName of the router pool to allocate from (for example a CGNAT pool)pool-cgnat
Mikrotik-Address-ListAdds the session's IP to an address list, used for suspension or policy routingsuspended
Framed-IPv6-PrefixIPv6 prefix on the PPP link (SLAAC)2a0x:1234:0:100::/64
Delegated-IPv6-PrefixPrefix delegated to the customer router (DHCPv6-PD)2a0x:1234:100::/56
Session-TimeoutMaximum session length in seconds (hotspot, prepaid)86400
Idle-TimeoutDisconnect after inactivity (hotspot)900
Acct-Interim-IntervalOverrides the router's interim-update per subscriber300
Mikrotik-GroupApplies a named PPP profile instead of the defaultbusiness
Reply-MessageReason text returned on reject, visible in the router logAccount suspended

Reading Mikrotik-Rate-Limit correctly

The format is rx/tx from the router's point of view, which means upload/download from the subscriber's point of view. The full form is:

rx-rate/tx-rate [rx-burst/tx-burst [rx-threshold/tx-threshold [rx-time/tx-time [priority [rx-min/tx-min]]]]]

So 20M/200M 30M/300M 20M/200M 30/30 8 means a 200 Mbps download plan that may burst to 300 Mbps for up to 30 seconds while the average stays under 200 Mbps, at queue priority 8. If speeds look reversed, the plan was written download/upload by mistake. It is the most common attribute error we see.

Step 5: Example FreeRADIUS configuration

If you run your own FreeRADIUS, each MikroTik is a client with its own secret, and a subscriber is a row with check and reply attributes. In production these rows come from your billing database (SQL module), never from hand-edited files.

# /etc/freeradius/3.0/clients.conf
client bng1 {
    ipaddr = 10.0.0.1
    secret = unique-secret-bng1
    nas_type = other
}

# Equivalent of one subscriber (normally in the radcheck / radreply tables)
alice  Cleartext-Password := "s3cret"
       Mikrotik-Rate-Limit = "20M/200M",
       Framed-Pool = "pool-cgnat"

Test from the RADIUS host before touching a real customer:

echo "User-Name=alice,User-Password=s3cret" | radclient -x 127.0.0.1:1812 auth testing123

Step 6: Change speed without disconnecting (CoA)

When a customer upgrades, there is no reason for their connection to drop. The server sends a CoA-Request to the live session with the new Mikrotik-Rate-Limit; RouterOS updates the dynamic queue in a second and the subscriber notices nothing. Keep Disconnect-Request for cases where you really want the session to end: moving to a different IP pool, a different BNG, or a hard suspension.

# From the RADIUS server, change the speed of a live session
echo "User-Name=alice,Mikrotik-Rate-Limit=\"30M/300M\"" | \
  radclient -x 10.0.0.1:3799 coa unique-secret-bng1

If the CoA returns NAK, check that /radius incoming is enabled, that UDP 3799 is not filtered, and that the secret matches the router entry.

Step 7: Soft suspension instead of a hard disconnect

For an unpaid account, cutting the line is the worst first move: the customer sees "no internet", assumes a fault and calls support. A better pattern is a walled garden:

  1. RADIUS returns (or CoA pushes) Mikrotik-Address-List=suspended.
  2. A firewall rule redirects HTTP from that list to your payment page and allows only DNS and the payment provider.
  3. The customer reads why the service is limited, pays online, and the platform sends a CoA that removes the list. Service is back in seconds without a call.
/ip firewall nat
add chain=dstnat src-address-list=suspended protocol=tcp dst-port=80 \
    action=dst-nat to-addresses=10.0.0.50 to-ports=80 comment="captive portal"
/ip firewall filter
add chain=forward src-address-list=suspended dst-address=10.0.0.50 action=accept
add chain=forward src-address-list=suspended protocol=udp dst-port=53 action=accept
add chain=forward src-address-list=suspended action=drop

We cover the full flow, including dunning schedules, in captive portal and automated subscriber suspension.

Step 8: Redundancy and scaling

  • Two RADIUS servers, both answering from the same database or a replicated one. One server means one maintenance window takes the whole network down for new logins.
  • Short timeouts (2–3 seconds) so a dead server fails over quickly instead of stalling every login.
  • Several BNGs: split subscribers by area or VLAN, each with its own secret and NAS identifier, so you can see exactly where a session lives.
  • Accounting database hygiene: close stale sessions that never received a Stop, or your "online now" count and volume billing drift.

Troubleshooting MikroTik RADIUS

SymptomLikely causeWhere to look
"RADIUS server is not responding"Wrong src-address, firewall, or server does not know this NAS/radius monitor 0, server log
Access-Reject for a paying customerWrong password, account suspended in billing, or local secret overriding/log print where topics~"radius", Reply-Message
Speed reversed or wrongRate limit written download/upload instead of upload/download/queue simple print on the dynamic queue
Plan change only applies after reconnectCoA disabled or UDP 3799 blocked/radius incoming print
"Online" count higher than realityAccounting disabled or no interim updates, sessions never closed/ppp aaa print, accounting table
Logins slow during peakSingle overloaded server or long timeoutServer response time, timeout per entry

Useful commands on the router: /radius monitor 0 shows requests, accepts, rejects and timeouts per server; /ppp active print lists live sessions; /log print where topics~"radius" shows each decision.

Five mistakes we see most often

  1. The same shared secret on every router. One compromised device unlocks AAA for the whole network.
  2. Speed set locally in a PPP profile or queue "temporarily", which stays for years and disagrees with billing.
  3. No accounting, or interim updates disabled: you do not know who is online, cannot bill by volume, and live sessions never clear.
  4. No second RADIUS server. Maintenance on one box means no new connections anywhere.
  5. Rejects without a reason. Without Reply-Message and logging of why a login failed, "one customer can't connect" becomes half a day of work.

How Veloxiom handles MikroTik RADIUS

Veloxiom includes a built-in RADIUS server tied directly to billing. Plans map to Mikrotik-Rate-Limit profiles, static IPs and pools; suspension and reactivation are real CoA or disconnect messages triggered by invoices and payments; and every subscriber record shows the live PPPoE or IPoE session, last disconnect reason and traffic. MikroTik routers are also managed over the RouterOS API, alongside Cisco, Juniper, Ubiquiti and Mimosa equipment. See RADIUS server and MikroTik management for the feature details, or the ISP platform overview.

Frequently asked questions

Do I need FreeRADIUS, or is a billing platform enough?

Both models work as long as users and speeds come from the billing database. What matters is not which daemon answers but that there is no second, hand-maintained list of users.

Which RADIUS attribute sets speed on MikroTik?

Mikrotik-Rate-Limit, in the form upload/download from the subscriber's point of view, for example 20M/200M. Burst, priority and minimum rate are optional extra fields.

Can I change speed without disconnecting the subscriber?

Yes. Enable /radius incoming accept=yes and send a CoA-Request with the new Mikrotik-Rate-Limit to UDP port 3799. Without CoA the change only applies at the next login.

How often should MikroTik send interim updates?

Every 5 to 10 minutes. That is frequent enough for accurate "online" status and volume billing, and sparse enough not to overload the database with thousands of sessions.

Does RADIUS work with DHCP on MikroTik, not only PPPoE?

Yes. Set use-radius on the DHCP server; the router authorizes each lease by MAC address (or Option 82) and the server returns IP, speed and address list.

Does the same setup work on Cisco, Juniper or Ubiquiti?

The logic is the same, but vendor-specific attributes differ. A multi-vendor platform has to send the right attribute set for each NAS type.

Related reading

Try the Veloxiom demo