The Freeradius installation configuration process, most of the data are collected from the Internet. Each step is validated, documented and archived.
Extract
TAR-ZXVF freeradius-server-2.1.12.tar.gz
CD freeradius-server-2.1.12
Installation
./configure
Make
Make install
Debugging
Radiusd-x
Listening on authentication address * Port 1812
Listening on accounting address * Port 1813
Listening on command file/usr/local/var/run/radiusd/radiusd.sock
Listening on authentication address 127.0.0.1 Port 18120 as server Inner-tunnel
Listening on proxy address * Port 1814
Ready to process requests.
Start
Radiusd
Log
/usr/local/var/log/radius/radius.log
Test
Radtest [d raddb_directory] User password radius-server nas-port-number secrect
Nas-port-number: No, just 0.
Secret: is the corresponding client's password in client.conf (after RADIUS is installed, the local client127.0.0.1 password defaults to testing123)
# radtest test test localhost 0 testing123
Sending access-request of ID to 127.0.0.1 port 1812
User-name = "Test"
User-password = "Test"
Nas-ip-address = 127.0.0.1
Nas-port = 0
Rad_recv:access-reject packet from host 127.0.0.1 Port 1812, id=48, length=20
Although the user,passwd are fake, as long as the Access-reject is received, it also proves that the Freeradius server has started normally
Set up to boot from service
Copy the startup script file to the/ETC/INIT.D directory
Cp/usr/local/sbin/rc.radiusd/etc/init.d/radius
# Vi/etc/init.d/radius
After the #!/bin/sh line, add:
# RADIUSD This shell script takes care of starting and stopping
# standalone RADIUSD.
#
# Chkconfig:-70 70
# description:free RADIUS server.
# ProcessName:/USR/LOCAL/SBIN/RADIUSD
# config:/usr/local/etc/raddb
To use the command:
#chkconfig--add Radius
#chkconfig radius on
Configure MySQL
Database creation: Create DB radius;
Into the usr/local/etc/raddb/sql/mysql.
#mysql-U root-p radius <scheme.sql import tables into the database
After importing, you can use the command
#use radius;
#show Tabels; see the following database tables:
+------------------+
| Tables_in_radius |
+------------------+
| Radacct |
| Radcheck |
| Radgroupcheck |
| radgroupreply |
| Radpostauth |
| radreply |
| Radusergroup |
+------------------+
Modify the Defoult file under Usr/local/etc/raddb/site_enabled, remove the # in front of the SQL in authorize{}, accounting {}, and add the files in authorize{}
Modify the configuration file connected to the MySQL database/usr/local/etc/raddb/sql.conf
Server = "localhost"
Login = "root"
Password = "Login password for database root"
radius_db = "radius"//radius for database name
Modify configuration file/usr/local/etc/raddb/radiusd.conf
Remove the # number in front of the $include sql.conf
If you receive Rlm_sql (SQL): Could not link driver Rlm_sql_mysql:rlm_sql_mysql.so:cannot Open shared object file:no such file or Directory "error in driver package not found
A: Install Mysql-devel first
B: Then enter the Src/modules/rlm_sql/drivers/rlm_sql_mysql Run command under the Freeradius installation file directory:./configure--with-mysql-dir=/usr/share /mysql/--with-mysql-lib-dir=/usr/lib/mysql/
C:make
Make Intall
The driver of the Rlm_sql_mysql will be installed in the/usr/local/lib directory, but these drivers must be added to the/usr/lib directory to function properly: #cp-a/usr/local/lib/rlm_sql_mysql*/ Usr/lib
Add a test account to the database
#mysql-U root-p
Enter Password:
mysql> use RADIUS;
Set up group information:
mysql> INSERT INTO radgroupreply (groupname,attribute,op,value) VALUES (' User ', ' auth-type ', ': = ', ' local ');
Query OK, 1 row affected (0.01 sec)
mysql> INSERT INTO radgroupreply (groupname,attribute,op,value) VALUES (' User ', ' service-type ', ': = ', ' Framed-user ') ;
Query OK, 1 row Affected (0.00 sec)
mysql> INSERT INTO radgroupreply (groupname,attribute,op,value) VALUES (' User ', ' framed-ip-address ', ': = ', ' 255.255.255.255 ');
Query OK, 1 row Affected (0.00 sec)
mysql> INSERT INTO radgroupreply (groupname,attribute,op,value) VALUES (' User ', ' framed-ip-netmask ', ': = ', ' 255.255.255.0 ');
Query OK, 1 row affected (0.01 sec)
Create User information:
mysql> INSERT INTO Radcheck (username,attribute,op,value) VALUES (' Test ', ' User-password ', ': = ', ' test ');
Query OK, 1 row Affected (0.00 sec)
To join a user in a group:
mysql> INSERT INTO Radusergroup (username,groupname) VALUES (' Test ', ' user ');
Query OK, 1 row affected (0.01 sec)
mysql>exit; Exit Database
Test
#radtest test test localhost 0 testing123
Sending access-request of ID 222 to 127.0.0.1 Port 1812
user-name = "Test" User-password = "Test"
N as-ip-address = 127.0.0.1
nas-port = 0
rad_recv:access-accept Packet from host 127.0.0.1 Port 1812, id=222, length=38
service-type = Framed-user
framed-ip-address = 255.255.255.255
& nbsp; framed-ip-netmask = 255.255.255.0
If the information is displayed, congratulations, Freeradius the installation configuration was successful.