FreeRadius安裝配置

2021-09-01 09:32:51 字數 3563 閱讀 8795

自己整理的freeradius安裝配置過程,大部分資料都是從網上收集的。每一步都經過驗證,記錄下來歸檔。

解壓tar -zxvf freeradius-server-2.1.12.tar.gz

cd freeradius-server-2.1.12

安裝./configure

make

make install

除錯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.

啟動radiusd

日誌/usr/local/var/log/radius/radius.log

測試radtest [-d raddb_directory] user password radius-server nas-port-number secrect

nas-port-number:用不到,就為0即可

secret:就是在client.conf裡的對應client的口令 (radius安裝完後,本地client127.0.0.1的口令預設就是testing123)

# radtest test test localhost 0 testing123

sending access-request of id 48 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

儘管user,passwd都是假的,但只要收到access-reject,也證明freeradius 伺服器已經正常啟動

設定為開機自啟動服務

把啟動指令碼檔案複製到/etc/init.d目錄下

cp /usr/local/sbin/rc.radiusd /etc/init.d/radius

# vi /etc/init.d/radius

在 #!/bin/sh 一行後面加入:

# 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

使用命令:

#chkconfig --add radius

#chkconfig radius on

配置mysql

建立資料庫:create database radius;

進入usr/local/etc/raddb/sql/mysql下

#mysql -u root -p radius c:make

make intall  

這時候會把rlm_sql_mysql的驅動安裝到/usr/local/lib目錄下,但是必須把這些驅動copy到/usr/lib目錄下才能正常執行:#cp -a /usr/local/lib/rlm_sql_mysql* /usr/lib

在資料庫中加入測試帳號

#mysql -u root -p

enter password:

mysql> use radius;

建立組資訊:

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)

建立使用者資訊:

mysql> insert into radcheck (username,attribute,op,value) values ('test','user-password',':=','test');

query ok, 1 row affected (0.00 sec)

將使用者加入組中:

mysql> insert into radusergroup (username,groupname) values ('test','user');

query ok, 1 row affected (0.01 sec)

mysql>exit;退出資料庫

測試#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"

nas-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

framed-ip-netmask = 255.255.255.0

如果顯示如上資訊,則恭喜,freeradius安裝配置成功。

FreeRadius安裝配置

自己整理的freeradius安裝配置過程,大部分資料都是從網上收集的。每一步都經過驗證,記錄下來歸檔。解壓tar zxvf freeradius server 2.1.12.tar.gz cd freeradius server 2.1.12 安裝.configure make make inst...

freeradius的安裝與配置

安裝centos作業系統,然後按照 這篇文章裡面寫的,安裝mysql之類的 make install安裝以後的檔案在 usr local share freeradius 可以通過radiusd x來做首次啟動,注意首次啟動必須是root賬戶才行,還有注意那個x是大寫的.在openssl發現hear...

freeRadius安裝測試

需要 openssl ubuntu安裝openssl apt get 無法安裝 openssl devel請執行 sudo apt get install openssl sudo apt get install libssl dev 1.得到freeradius git clone git cd ...