分类: LINUX
2012-01-04 16:01:30
[Radius]服务安装及测试
#local net
192.168.67.0/24
#install
1 tar xzvf freeradius-server-2.1.1.tar.gz
2 x86: cd freeradius-server-2.1.1 && ./configure && make
&& make install
3 x86_64: cd freeradius-server-2.1.1 && ./configure
--enable-shared&& make && make install
#config
1 cd /usr/local/etc/raddb
2 vi clients.conf
client 192.168.67.0/24 {
secret = 67
shortname = 67.0/24
}
client 192.168.66.0/24 {
secret = 66
shortname = 66.0/24
}
#start service in debug mode
1 radiusd -X
If ok will receive "Ready to process requests."
#test
1 useradd test
2 echo "test" |passwd test --stdin
3 radtest test test 192.168.67.101 0 67
If ok will receive "rad_recv: Access-Accept"
测试配置sql身份验证方式
1 cd /usr/local/etc/raddb/site-available
2 vi default #use sql
authorize {
#unix #rem unix for test
sql #add this line
}
accounting {
sql #add this line
}
3 create radius database and tables #Info just for test use mysql auth
mysql -e "create database radius"
for i in `ls /tmp/freeradius-server-2.1.1/raddb/sql/mysql/*.sql`;do mysql
radius < /tmp/freeradius-server-2.1.1/raddb/sql/mysql/$i;done
mysql radius -e "insert into radgroupreply (groupname,attribute,op,value)
values ('user','Auth-Type',':=','Local')"
mysql radius -e "insert into radgroupreply (groupname,attribute,op,value)
values('user','Service-Type',':=','Framed-Used')"
mysql radius -e "insert into radgroupreply (groupname,attribute,op,value)
values('user','Framed-IP-Address',':=','255.255.255.254')"
mysql radius -e "insert into radgroupreply (groupname,attribute,op,value)
values('user','Framed-IP-Netmask',':=','255.255.255.0')"
mysql radius -e "insert into radcheck (username,attribute,op,value)
values('test','User-Password',':=','test')
mysql radius -e "insert into usergroup (username,groupname)
values('test','user')"
4 同样使用radtest测试