radius server簡單安裝配置方法

安裝

sudo aptitude install freeradius

添加測試用戶

用戶名爲test,密碼爲111111shell

sudo echo "test Cleartext-Password := \"111111\"" >> /etc/freeradius/users

添加client網段

vim /etc/freeradius/clients.conf

加入下面內容,表示只接受192.168.26.0這個網段的client進行radius認證,
其中共享密鑰爲testing123vim

client 192.168.26.0/24 {
        secret = testing123
        shortname = test-radius
}

重啓radius服務

sudo service freeradius restart

測試

在192.168.26.0/24網段的PC,或直接用本機測試

radtest test 111111 <radius-server-addr> 0 testing123

如在本地執行rest

radtest test 111111 192.168.26.214 0 testing123

認證成功輸出結果code

Sending Access-Request of id 74 to 192.168.26.214 port 1812
    User-Name = "test"
    User-Password = "111111"
    NAS-IP-Address = 127.0.1.1
    NAS-Port = 0
rad_recv: Access-Accept packet from host 192.168.26.214 port 1812, id=74, length=20

如在本地執行server

radtest test 222222 192.168.26.214 0 testing123

認證失敗輸出結果it

Sending Access-Request of id 233 to 192.168.26.214 port 1812
    User-Name = "test"
    User-Password = "222222"
    NAS-IP-Address = 127.0.1.1
    NAS-Port = 0
rad_recv: Access-Reject packet from host 192.168.26.214 port 1812, id=233, length=20
相關文章
相關標籤/搜索