How to run multiple instance of freeRADIUS on one server
Phil Mayers
p.mayers at imperial.ac.uk
Mon Nov 18 13:07:44 CET 2013
On 18/11/13 10:44, Kwesi Yankson wrote:
> Thank you Brian,
> I know it is possible. My concern is HOW TO DO IT. That's what I need
> help with. Can you help?
Here's how I do it. Basically, use the "-n" argument to radiusd, ${}
expansion, and a bit of $INCLUDE stuff to reduce typing.
1. Each server instance lives in "/etc/raddb/blah.conf" and looks like this:
# The next line is a marker for the init script:
# RADIUS INSTANCE
# per-process stuff goes here; reference it elsewhere
# with ${svopts.name} - see the next stop for examples
svopts {
name = blah
status_port = 10001
num_threads = 10
...
}
# this file contains all the easy stuff - see next step
$INCLUDE common.conf
# load the various virtual servers
$INCLUDE sites-enabled/blah
$INCLUDE sites-enabled/blah-tunnel
$INCLUDE sites-enabled/status
2. We stick boring stuff in a "common.conf" file that uses variables
from the "svopts". For example:
# paths
prefix = /usr
...
# NOTE: using a per-process PID file
pidfile = ${run_dir}/radiusd-${svopts.name}.pid
log {
destination = files
# NOTE: per-proces logfile
file = ${logdir}/radius-${svopts.name}.log
...
}
thread pool {
start_servers = ${svopts.num_threads}
max_servers = ${svopts.num_threads}
}
3. We have a custom init script that basically does this:
start() {
for instance in `egrep -l '^# RADIUS INSTANCE' /etc/raddb/*.conf`
do
NAME=`basename $instance .conf`
radiusd -d /etc/raddb -n $NAME
done
}
stop() {
for instance in `egrep -l '^# RADIUS INSTANCE' /etc/raddb/*.conf`
do
NAME=`basename $instance .conf`
PID=`cat /var/run/radius/radiusd-$NAME.pid`
[ -n "$PID" ] && kill $PID
done
}
More information about the Freeradius-Users
mailing list