When a client authenticates, the server checks the username and password against the user database. If the credentials match, the client is authorized. However, with a large number of users, the authorization process can take a long time.
To solve this problem, it is suggested to use parallel servers and load balancing between them based on each server's load. This way, clients still have a single entry point — the Radius server, which is actually replaced by a proxy server (it only balances requests among the servers it knows). The proxy server remembers that if it authorized user A on server B, the request will predominantly be directed to the same server B.
The FreeRADIUS package is configured as a load-balancing proxy server, distributing requests from many clients to a single access point to multiple servers.
Step 1. Adding the proxy to the server's client list
In the configuration file clients.conf
on the Radius server side, define the proxy as a client:
client client1 { ipv4addr = 10.10.10.61 secret = testing123 }
Step 2. Adding the client to the proxy's client list
In the configuration file clients.conf
on the proxy side, define the client:
client client1 { ipv4addr = 10.10.10.60 secret = testing123 }
Step 3. Adding servers and load balancing parameters to the proxy configuration
In the proxy.conf
file of the proxy configuration:
home_server localhost {}
section for the number of servers;ipv4addr = server_address
parameter:home_server server1 { ipv4addr = 10.10.10.62 } home_server server2 { ipv4addr = 10.10.10.63 }
home_server_pool my_auth_failover {}
sectiontype = fail-over
parameter to type = load-balance
(description of balancing modes in the section Balancing Mode Options)home_server = localhost
home_server = section_name
for each server from step 2 home_server_pool my_auth_failover { type = load-balance //home_server = localhost home_server = server1 home_server = server2 }
mods-enabled
directory (it contains symbolic links to module configurations that "should be loaded").
fail-over
- the request is sent to the first live home server in the list. i.e. If the first home server is marked "dead", the second one is chosen, etc.load-balance
- the least busy home server is chosen, where "least busy" is counted by taking the number of requests sent to that home server, and subtracting the number of responses received from that home server.client-balance
- the home server is chosen by hashing the source IP address of the packet. If that home server is down, the next one in the list is used, just as with "fail-over".client-port-balance
- the home server is chosen by hashing the source IP address and source port of the packet. If that home server is down, the next one in the list is used, just as with "fail-over".keyed-balance
- the home server is chosen by hashing (FNV) the contents of the Load-Balance-Key attribute from the control items. The request is then sent to home server chosen by taking:server = (hash % num_servers_in_pool)
If there is no Load-Balance-Key in the control items, the load balancing method is identical to "load-balance".
For most non-EAP authentication methods, The User-Name attribute provides a good key. An "unlang" policy can be used to copy the User-Name to the Load-Balance-Key attribute. This method may not work for EAP sessions, as the User-Name outside of the TLS tunnel is often static, e.g. "anonymous@realm".