Ubuntu + FreeRadius + MySQL
Ubuntu + FreeRadius + MySQL
by anto chuakev on Jan.03, 2010, under Linux, Ubuntu + FreeRadius + MySQL
Membuat radius server untuk kebutuhan mikrotik hotspot. Pada tutor ini, menggunakan Ubuntu 8.10 dengan package FreeRadius dan MySQL Server yang di dapat dari repository. Selain itu juga akan dilengkapi dengan Apache 2, PHP 5 dan PHPMyAdmin.
- Asumsi bahwa OS Ubuntu 8.10 sudah terinstall dan terkoneksi dengan jaringan internet. Selanjutnya adalah installasi semua package yang dibutuhkan.
- Install semua package melalui repository dan isi konfigurasi yang diminta
# apt-get install apache2 php5-common php5-gd php-pear php-db libapache2-mod-php5 php5-mysql php5-mcrypt phpmyadmin mysql-server-5.0 mysql-client-5.0 freeradius freeradius-mysql
- Untuk konfigurasi apache2, php5 dan mysql-server-5 dan phpmyadmin dapat dicari diinternet.
- Selanjutnya adalah konfigurasi untuk freeradius
- Buat database radius pada mysql-server dan usernya
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 693
Server version: 5.0.67-0ubuntu6 (Ubuntu)Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql> create database radius;
Query OK, 1 row affected (0.00 sec)mysql> grant all on radius.* to radius@localhost identified by “passwordradius”;
Query OK, 0 rows affected (0.00 sec)mysql> exit
Bye - Sehubungan menggunakan freeradius 2.x, maka konfigurasi agak berbeda dengan freeradius 1.x. Lalu import table yang berada pada file /etc/freeradius/sql/mysql/schema.sql ke database radius
# mysql -u root -p radius < /etc/freeradius/sql/mysql/schema.sql
Enter password: - Buat table agar konfigurasi nas dapat ditambahkan pada database. Pengertian NAS dapat dilihat pada website http://wiki.freeradius.org/NAS
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 693
Server version: 5.0.67-0ubuntu6 (Ubuntu)Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql> use radius;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
mysql> CREATE TABLE nas (id int(10) NOT NULL auto_increment, nasname varchar(128) NOT NULL, shortname varchar(32), type varchar(30) DEFAULT ‘other’, ports int(5), secret varchar(60) DEFAULT ’secret’ NOT NULL, community varchar(50), description varchar(200) DEFAULT ‘RADIUS Client’, PRIMARY KEY (id), KEY nasname (nasname));
Query OK, 0 rows affected (0.01 sec)mysql> exit
Bye - Konfigurasikan /etc/freeradius/sql.conf agar dapat disesuaikan dengan perubahan yang sudah dilakukan
# pico /etc/freeradius/sql.confPada connection info
# Connection info:
server = “localhost”
login = “radius”
password = “passwordradius”Uncomment pada readclients agar NAS dapat dibaca melalui database.
readclients = yes - Selanjutnya mengubah file /etc/freeradius/sites-enabled/default
# pico /etc/freeradius/sites-enabled/defaultUncomment sql pada bagian authorize{}
# See “Authorization Queries” in sql.conf
sqlUncomment sql pada bagian accounting{}
# See “Accounting queries” in sql.conf
sqlUncomment sql pada bagian session{}
# See “Simultaneous Use Checking Queries” in sql.conf
sqlUncomment sql pada bagian post-auth{}
# See “Authentication Logging Queries” in sql.conf
sql - Tambahkan user untuk mengetest bahwa server radius sudah berjalan dengan baik
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 693
Server version: 5.0.67-0ubuntu6 (Ubuntu)Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql> use radius;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
mysql> INSERT INTO radcheck (UserName, Attribute, Value) VALUES (’sqltest’, ‘Password’, ‘testpwd’);
Query OK, 1 row affected (0.00 sec)mysql> exit
Bye - Pastikan bahwa konfigurasi radiusd.conf dalam keadaan benar, karena pada saat dicoba, terjadi masalah pada pid radiusnya
# pico /etc/freeradius/radiusd.confUbah run_dir ke path berikut
run_dir = ${localstatedir}/run/freeradiusUbah pidfile ke nama file berikut
pidfile = ${run_dir}/freeradius.pid - Jalankan server radius. Apabila ingin menggunakan mode debug, maka dapat menggunakan perintah freeradius -X
# /etc/init.d/freeradius start - Jalankan test pada server radius localhost
# radtest sqltest testpwd localhost 1812 testing123
Sending Access-Request of id 9 to 127.0.0.1 port 1812
User-Name = “sqltest”
User-Password = “testpwd”
NAS-IP-Address = 192.168.1.10
NAS-Port = 1812
rad_recv: Access-Accept packet from host 127.0.0.1 port 1812, id=9, length=20Apabila tampilan seperti diatas, berarti client dapat terkoneksi dengan server radius. Apabila terdapat error, maka solusinya cari diinternet

- Hapus user test yang sudah dibuat sebelumnya
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 699
Server version: 5.0.67-0ubuntu6 (Ubuntu)Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.mysql> use radius;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
mysql> delete from radcheck where UserName=’sqltest’;
Query OK, 1 row affected (0.00 sec)mysql> exit
Bye
Matur Nuwun Artikel nya Mas Hanadi…….
Ref :
http://www.8021xhelp.com/node/6
http://solo.foss-id.web.id/2008/09/instalasi-freeradius-pada-ubuntu-server-804/
http://forum.rtrw.net/viewtopic.php?f=4&t=5784
http://hanadi.wordpress.com
Looking for something?
Use the form below to search the site:
Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!
Design by bonkqloph Production
Archives
All entries, chronologically...
