freeradius with multi mysql database and multi virtual server

Alan Buxey alan.buxey at
Wed Nov 14 16:19:12 CET 2018

Use sql1: in the unlang instead of sql:

...or don't use the same virtual server and define a new virtual server
instance and use the virtual_server directive in the clients.conf to ensure
all requests from the second NAS go through that different server config


On Wed, 14 Nov 2018, 06:01 mohamad buvaydanı <starking123eng at

> favorit
> <
> >I
> have tow NAS and I want to run freeradius server with tow database (one
> database for every NAS); I have tow sql modules the first one is SQL and
> the another one is SQL1 the SQL module configured to connect to radius
> database , SQL1 configured to connect to radius2 database . in
> /etc/freeradius/sites-enabled
> folder I created new virtual server which has name student so in that
> folder there are tow file (default, student); I configured default to work
> with SQL module which connect to radius database,whereas I configured
> student to connect to SQL1 module which connect to radius2 database . I
> added this unlang code in every virtual server file to get information from
> every database
> Tmp-String-0  := "%{sql:SELECT value from radcheck WHERE
> attribute='CS-Total-Octets-Daily' and username='%{User-Name}'}"
> Tmp-String-1  := "%{sql:SELECT sum(AcctInputOctets)+sum(AcctOutputOctets)
> AS
>  Total FROM radacct where DATE(AcctstartTime )= CURDATE() AND
>  radacct.username='%{User-Name}'}"
> but my problem is that the student virtual server trying to get this data
> from radius database which is belong to SQL module even if I configured it
> to work with SQL1 . why is that happen , and how can I solve it
> -
> List info/subscribe/unsubscribe? See

More information about the Freeradius-Users mailing list