Table of Contents
Setting Up CoA Proxy
Updated
by Jennifer Trower
Read Time: 4 mins
A limitation of provisioning with RADIUS is that attribute changes don’t always take effect right away. For example, with PPPoE, updates typically won’t apply until the PPPoE session disconnects and reconnects. Some settings can be applied immediately using a Change of Authorization (CoA) request, but many still require a disconnect.
Sonar can automatically disconnect a customer when certain events occur by sending a Disconnect or CoA (Change of Authorization) packet to your RADIUS server. This can force customer updates without manually dropping their PPPoE session.
For this to work, your RADIUS server must be configured to proxy CoA/Disconnect packets to the NAS, since Sonar sends these packets to the RADIUS server directly. The basic FreeRADIUS configuration shown below enables this proxying and was tested on version 3.2.5 (you may need to adjust it for other versions).
When using CoA proxying, you must disable use of the nas SQL table, because the coa_server setting can’t be defined in SQL.
sudo su) or prefix commands with sudo.
- SSH to RADIUS server and navigate to the freeradius directory by typing the following command:
cd /etc/freeradius/3.0
If you type ll to view the directory, you should see the following files:radiusd.confclients.confproxy.conf - Use a text editor to look at
radiusd.confnano radiusd.conf
This file should not require any modification, but confirm the following lines are written:proxy_requests = yes
$INCLUDE proxy.conf - Use a text editor to look at clients.conf
nano clients.conf
Put every NAS listed inHere is an example of a finished clients.conf:clients.confinto the samecoa_servergroup. Then add your Sonar instance as a client, settingipaddrto your Sonar server’s IP (as shown inclient sonar { }). Thesecretvalue in that Sonar client entry is what you’ll enter in Sonar’s CoA Secret field when setting up CoA proxying.client myroutername1 {
ipaddr = 10.220.5.1 # Your NAS IP
secret = reallysecret # RADIUS secret for this NAS
nas_type = mikrotik
coa_server = concentrators
}
client myroutername2 {
ipaddr = 10.220.5.2 # Another NAS IP
secret = reallysecret # RADIUS secret for this NAS
nas_type = mikrotik
coa_server = concentrators
}
client sonar1 {
ipaddr = 20.221.112.37 # Sonar Instance IP
secret = sonarcoasecret # Sonar CoA Secret
nas_type = other
coa_server = concentrators
}
client sonar2 {
ipaddr = 20.221.114.13
secret = sonarcoasecret
nas_type = other
coa_server = concentrators
}
client sonar3 {
ipaddr = 52.158.209.86
secret = sonarcoasecret
nas_type = other
coa_server = concentrators
}
client sonar4 {
ipaddr = 20.15.246.160/28
secret = sonarcoasecret
nas_type = other
coa_server = concentrators
}
client sonar5 {
ipaddr = 20.84.143.0/28
secret = sonarcoasecret
nas_type = other
coa_server = concentrators
}You can also use the tool at https://jemnetworks.com/coa to generateclients.confandproxy.conf. Enter your NAS details as comma- or tab-separated values in this format:NAS-Name, IP-Address, CoA-Secret, CoA-Port - Use a text editor to modify proxy.conf
nano proxy.conf
Add each NAS as aHere is an example of a filled-out proxy.conf:home_serverinproxy.conf, using the sameipaddrvalues from your NAS entries inclients.conf. Then list all of thosehome_serverentries in thehome_server_poolsection (one per line). You need a pool entry for each IP so theupdate controlsection insites-enabled/coaworks.home_server myroutername1 {
type = coa
ipaddr = 10.220.5.1
port = 3799
secret = reallysecret
require_message_authenticator = no
response_window = 20
zombie_period = 40
revive_interval = 120
status_check = none
check_interval = 30
num_answers_to_alive = 3
coa {
irt = 2
mrt = 16
mrc = 5
mrd = 30
}
}
home_server myroutername2 {
type = coa
ipaddr = 10.220.5.2
port = 3799
secret = reallysecret
require_message_authenticator = no
response_window = 20
zombie_period = 40
revive_interval = 120
status_check = none
check_interval = 30
num_answers_to_alive = 3
coa {
irt = 2
mrt = 16
mrc = 5
mrd = 30
}
}
home_server_pool concentrators {
home_server = myroutername1
home_server = myroutername2
}
home_server_pool 10.220.5.1 {
home_server = myroutername1
}
home_server_pool 10.220.5.2 {
home_server = myroutername2
} - Navigate to the following directory
cd /etc/freeradius/3.0/sites-enabled
Run the following command to create a new file called "coa"nano coa
- Copy the text exactly as is below and paste and save this in the "
coa" file.listen {
type = coa
ipaddr = *
port = 3799
virtual_server = coa
}
server coa {
recv-coa {
update control {
Home-Server-Pool := "%{NAS-IP-Address}"
}
ok
}
send-coa {
ok
}
} - If you haven’t already, disable the NAS table as mentioned earlier. To accomplish this, reopen the setup wizard (“genie”) you used to configure the RADIUS database:
cd /home/<user>/freeradius_genie-v3
The genie installs under the home directory of the user who ran the installer (for example,
php genie/home/<user>). If you set up the genie as root, your home directory will be/root, so file paths (and screenshots) may look different.If you can’t find the genie folder, locate it with:find / -type d -name "freeradius_genie-v3" -print 2>/dev/null - Open the NAS configuration screen, then scroll to Remove NAS and delete the NAS entries you added when setting up the server. Remove them because they’re now configured under the CoA settings instead.

- systemctl restart freeradius
- Enter: systemctl status freeradiusTo confirm it’s working, disconnect an active session from the customer’s account.

- Look at the Start Time next to the active session. After you disconnect it, the session should reconnect automatically within a few seconds (sometimes up to 1–2 minutes), and the Start Time will update to the current time.
- On the NAS (MikroTik), you can watch this in real time in PPP > Active Connections (or Queues > Simple Queues). The client will disappear, then reappear with a refreshed session—and a new queue if the service changed.