FreeRadius multiple domains

We use freeradius to 802.1x auth our wireless users. We need to authenticate users that may be on one of two domains. We have an issue with trying to authenticate to the global catalog because we have duplicate user account names that have been created on each domain. That wasn’t my idea and it can’t be fixed, so I have to work around the issue. One way to fix the issue is to have the user append the domain when they authenticate, but we don’t want to make things harder for end users.

With freeRadius, I was able to use some freeRadius unlang. I wanted to share some of the config with you. I’m assuming you have most of your freeradius running at a point where you can authenticate against one domain via mschap. Basically my config tries to auth the user by specifying one of the domains in one mschap module and specifies the other domain in a new mschap module. If the user fails on authentication to the first domain, then the second mschap module fires off with the second domain specified.

First, I modified my mschap module found in the following directory: /etc/raddb/modules/mschap

ntlm_auth = “/usr/bin/ntlm_auth –configfile=/etc/samba/smb.conf –request-nt-key –username=%{%{Stripped-User-Name}:-%{%{User-Name}:-None}} –domain=YourFirstDomainName –challenge=%{%{mschap:Challenge}:-00} –nt-response=%{%{mschap:NT-Response}:-00}”

I then created another mschap module instance by editing radius.conf found in the following directory: /etc/raddb/radius.conf

add the following:

mschap NameOfNewModule {
with_ntdomain_hack = yes
ntlm_auth = “/usr/bin/ntlm_auth –configfile=/etc/samba/smb.conf –request-nt-key –username=%{%{Stripped-User-Name}:-%{%{User-Name}:-None}} –domain =YourSecondDomainName –challenge=%{mschap:Challenge:-00} –nt-response=%{mschap:NT-Response:-00}”

Modify your inner-tunnel file with some freeRadius unlang found in /etc/raddb/sites-available/inner-tunnel
Add the following in the authorize { section:


Then add the following unlang in the authenticate { section:


Auth-Type MS-CHAP {
mschap {
reject = 2
if (reject) {