How to Send a MikroTik RADIUS CoA Packet Dynamically
26 October 2026 · 6 min read
RADIUS normally only acts at login. To change a customer's speed or remove them while they are online, the RADIUS server has to push a message to the router. That is Change of Authorization (CoA, RFC 5176), and MikroTik supports it for PPP and hotspot sessions.
Two packet types
- Disconnect-Request: asks the router to terminate a session so the user must log in again
- CoA-Request: changes attributes of a live session, such as the rate limit, without dropping it
Step 1: allow incoming RADIUS on the router
The router must listen for packets from your RADIUS server. The standard CoA port is 3799:
/radius incoming set accept=yes port=3799The RADIUS client entry on the router must use the same shared secret as the server, and the server must be able to reach the router on UDP 3799 through any firewall in between.
Step 2: send a Disconnect-Request
From a host with the FreeRADIUS utilities installed, radclient can send the packet:
echo "User-Name = 'john@isp'" | radclient -x 10.10.0.1:3799 disconnect CHANGE_MEA Disconnect-ACK reply means the session was found and dropped. A Disconnect-NAK usually means the user is not online or the identifying attribute did not match.
Step 3: change speed live with CoA-Request
echo "User-Name = 'john@isp', Mikrotik-Rate-Limit = '10M/10M'" | radclient -x 10.10.0.1:3799 coa CHANGE_METhis is how a package upgrade or a fair-usage throttle takes effect immediately instead of at the next login.
Why CoA silently fails
- Firewall: UDP 3799 is blocked between server and router
- Wrong secret: packets are dropped with no reply when the secret does not match
- Wrong identifier: the router matches on User-Name or Acct-Session-Id exactly as it appears in the session
- Source address: the router only accepts packets from addresses configured as RADIUS servers
Check the router log with the radius topic enabled to see rejected packets.
Let the billing system do it
Writing and monitoring CoA calls for every plan change is where homegrown setups break. Metron ISP sends a CoA request to routers that authenticate through RADIUS when a subscriber changes plan, and uses the RouterOS API for routers where it manages the PPPoE secret. Details on the RADIUS and MikroTik page.