That explains why the variables did not work. Thanks Alan. I still can“t get my sql queries working though with the below config. Do i need to use the queries/definitions in dialup.conf? Does the User-Name need to exist in the SQL database to be able to add a realm to it? I would like the server to find the realm in the database and just Proxy the access-request. listen { ipaddr = 192.168.199.5 port = 21000 type=auth virtual_server = SERVER-21000 } server SERVER-21000 { authorize { preprocess pap sql update request { Tmp-String-0 = "%{sql:select AccountIDSuffix FROM RequestGroup where AUTProxyPort = 21000}" } update request { User-Name := "%{User-Name}@%{Tmp-String-0}" } update control { Proxy-To-Realm := "AUT-OTP02" } } } debug: Listening on authentication address * port 1812 Listening on accounting address * port 1813 Listening on authentication address 192.168.199.5 port 21000 as server SERVER-21000 Listening on proxy address * port 1814 Ready to process requests. rad_recv: Access-Request packet from host 192.168.199.9 port 55578, id=50, length=60 User-Name = "testuser" User-Password = "testpass" NAS-IP-Address = 127.0.0.1 NAS-Port = 0 server SERVER-21000 { # Executing section authorize from file /etc/raddb/sites-enabled/all-servers +- entering group authorize {...} ++[preprocess] returns ok [pap] WARNING! No "known good" password found for the user. Authentication may fail because of this. ++[pap] returns noop [sql] expand: %{User-Name} -> testuser [sql] sql_set_user escaped user --> 'testuser' rlm_sql (sql): Reserving sql socket id: 4 [sql] expand: -> [sql] Error generating query; rejecting user rlm_sql (sql): Released sql socket id: 4 ++[sql] returns fail } # server SERVER-21000 Delaying reject of request 0 for 1 seconds Going to the next request Waking up in 0.9 seconds. Sending delayed reject for request 0 Sending Access-Reject of id 50 to 192.168.199.9 port 55578 -- View this message in context: http://freeradius.1045715.n5.nabble.com/FR-2-1-6-add-realm-to-User-Name-befo... Sent from the FreeRadius - User mailing list archive at Nabble.com.