[Quick Install] FreeRADIUS on CentOS and Ubuntu – Full Guide


General Public License (GNU) established and distributed free RADIUS suite (Collection) called “FreeRADIUS”. This is the prestigious suite for the developer as RADIUS (Remote Authentication Dial In User Service) which is a network protocol. RADIUS Protocol is an agent which defines set of rules and guidelines for governing communication among several Networks. Moreover, This is used for Accounting as well as Authenticating remote users.

Installation of FreeRADIUS:

Several providers such as ISP- Internet Service Providers, cellular Network providers (A&T, Verizon, U.S cellular, Sprint and many mnos) uses RADUIS Server for the purpose of communication.

You can easily install FreeRADIUS Suite in two ways from

  • Source Package
  • Repository

FreeRADIUS Installation on CentOS and UbuntuDownload FreeRADIUS Zip file using the below link

FreeRADIUS Server 2.1.11.tar.bz2

See Also: Install CentOS Web Panel, The Free CentOS hosting Control Panel

Quick Install FreeRADIUS:

Use this command to install freeradius on CentOS 5:

yum install freeradius2 freeradius2-mysql freeradius2-utils mysql-server –y

Use this command to install freeradius on CentOS 6:

yum install freeradius freeradius-mysql freeradius-utils mysql-server -y

Use this command to install freeradius on Ubuntu:

apt-get install freeradius freeradius-mysql freeradius-utils mysql-server

Start services in MySQL

In order to start services in MySQL, you have to use the following commands:

Command for CentOS

service mysqld start

Command for Ubuntu

service mysql start

Set Password in MySQL

For security reasons, setting password is must in MySQL setup. To proceed this, put this below code…

/usr/bin/mysql_secure_installation

Creating Radius Database is easily done using the following code:

mysql -uroot -p

After this command, enter a new root password in MySQL. To create Database in Radius, code as below

CREATE DATABASE radius;

GRANT ALL PRIVILEGES ON radius.* TO radius@localhost IDENTIFIED BY "radpass";

flush privileges;

Import table

mysql> use radius;

Code this in CentOS

SOURCE /etc/raddb/sql/mysql/schema.sql

Code this in Ubuntu

SOURCE /etc/freeradius/sql/mysql/schema.sql

Next you must use exit command

exit

Open the freeradius  in CentOS

/etc/raddb/sql.conf

To do same in Ubuntu, use code as follows

 /etc/freeradius/sql.conf

 

Then you need to enter into the Database which you have already created in MySQL DB like,

# Connection info:

server = "localhost"

#port = 3306 login = "radius"

password = "mypassword"

# Database table configuration for everything except Oracle

radius_db = "radius"

/etc/raddb/radiusd.conf is a directory which should be checked after entering into the Database. Use,

INCLUDE sql.conf

Edit /etc/raddb/sites-available/default code and change ‘sql’ in theauthorize{}, session{}, accounting {} sessions.

Also Edit /etc/raddb/sites-available/inner-tunnel code and slightly change ‘sql’ command in both session{} and authorize{} sessions.

Storing the secret in RADIUS:

If your file name is /etc/raddb/clients.conf, store your file as,

secret = testing123

This will become more secured and it will just like,

secret = anismolkkijbsn123365

How to restart RADIUS server?

You can easily restart the freeRADIUS by using 2 command lines as follows,

In CentOS word radiusd is used while in Ubunti we use freeradius as restarting keyword.

To restart in CentOS:

service radiusd restart

service radiusd stop

To restart in Ubuntu

service freeradius restart

service freeradius stop

Importing Database to MySQL directly

To import Database to MySQL directly use the below code

mysql -h 10.150.1.80 -u root -p radius < /etc/raddb/mods-config/sql/cui/mysql/schema.sql
mysql -h 10.150.1.80 -u root -p radius < /etc/raddb/mods-config/sql/ippool/mysql/schema.sql
mysql -h 10.150.1.80 -u root -p radius < /etc/raddb/mods-config/sql/ippool-dhcp/mysql/schema.sql
mysql -h 10.150.1.80 -u root -p radius < /etc/raddb/mods-config/sql/main/mysql/schema.sql
mysql -h 10.150.1.80 -u root -p radius < /etc/raddb/mods-config/sql/main/mysql/extras/wimax/schema.sql

See Also: How to remove all files from a directory in Linux?

How to ADD External clients (VPN Servers) in Radius?

Code for CentOS:

 /etc/raddb/clients.conf

Code for Ubuntu:

/etc/freeradius/clients.conf

Then, add

# coa_server = coa

}

client VPN_SERVER_IP {

secret          = YOUR SECRET

shortname       = yourVPN

nastype        = other

}

Now its time to connect your external clients with your freeRADIUS server. To do this code as below,

service radiusd restart

The above code is for CentOS. For Ubuntu use,

service freeradius restart

Login to the MySQL radius Database and Take a sample user and check in freeRADIUS Database by,

mysql -uroot –pyourrootpass

Go to radius database and enter,

use radius;

mysql> INSERT INTO `radcheck` (`id`, `username`, `attribute`, `op`, `value`) VALUE

radtest test test 127.0.0.1 0 mysecret

The code “radtest test test 127.0.0.1 0 mysecret” is to test the sample user is in working condition or not. By this you can able to verify that your server is in working stage.

Immediately you will receive an acceptance message as follows,

rad_recv: Access-Accept

That’s it. Your freeRadius is configured. Now you can ableto fix any problems using Debug mode by running freeRADIUS Suite.

In CentOS, you can debug by the below code

service radiusd stop

radiusd –x

And open the file using

/etc/raddb/sql.conf

And edit it using

#readclients = yes

In Ubuntu, you can debug by the below code

service freeradius stop

freeradius –x

And open the file using

/etc/freeradius/sql.conf

And edit it using

#readclients = yes

See Also: Install speedtest-cli in CentOS, Ubutnu, Fedora and Linux Mint

Hope this post answered all your questions. Now your freeRADIUS Suite is ready to serve your demands with high performing quality.  Enjoy using this free open source. If you have any other queries, feel free to comment us below…

6:51 pm