FreeRadius enable Virtual site with SQL

1. Create MySQL/ Postgresql Database and user

2. import FreeRadius database schema in


3. edit sql configuration file and fill in database details


	server = "hostname-here"
	port = 3306
	login = "database-login-here"
	password = "password-here"
	radius_db = "database-name-here"

4. if more than one database (for different application), copy the whole section, add an instance name and change the database details:

sql {


sql instance1

5. copy "default" configuration file to "virtual1" (or any name)

6. Edit "virtual1" file. and make the following changes

a) Change the virtual site name:

server default {


server virtual1

b) Change the port number

port = 55555

c) enable sql, 

find the following line

#      sql

and change to


"instance1" is the sql instance name added in step 4

7. Add a client for this virtual host

client your-device {
       ipaddr =
       secret = secretPhrase
       virtual_server = virtual1

your-device is profile name

ipaddr is IP address (or IP address range) for your device(s). If more than 1, need to use "|" to separate

secret is the passphrase to use the radius service

virtual_server is the virtual site name used in step 5.

8. add user into the database

insert into radusergroup (username, groupname, priority) VALUES ('username','groupname', 1);
insert into radcheck (username, attribute, op, value) VALUES ('username', 'Cleartext-Password', ':=', 'password');

9. Restart radiusd