sudo aptitude install freeradius
用戶名爲test
,密碼爲111111
shell
sudo echo "test Cleartext-Password := \"111111\"" >> /etc/freeradius/users
vim /etc/freeradius/clients.conf
加入下面內容,表示只接受192.168.26.0
這個網段的client進行radius認證,
其中共享密鑰爲testing123
vim
client 192.168.26.0/24 { secret = testing123 shortname = test-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