UBUUTU7.10上安装配置freeradius+mysql+rp(3)

6、配置freeradius+sql:

# cd /usr/local/freeradius/etc/raddb

将radiusd.conf中authorize和accouting项中的sql前的“#”去掉

更改sql.conf文件中:

server=”localhost”

login=”root”

password=”MySQL的root的密码”

radius_db=”radius”

将users中的下面两行注释掉:

DEFAULT Auth-Type = System     (这个是从系统获取帐号和密码来认证)51Testing软件测试网$c!R9kHvSP-C
            Fall-Through = 1

# cd /usr/local/mysql

# bin/mysql -uroot -p111111 radius < (freeradius路径)/doc/examples/mysql.sql

# bin/mysql –uroot –p111111 radius

mysql>insert into radgroupreply (groupname,attribute,op,value) values ('user','Auth-Type',':=','Local');

mysql>insert into radgroupreply (groupname,attribute,op,value) values ('user','Service-Type',':=','Framed-User');

mysql>insert into radgroupreply (groupname,attribute,op,value) values ('user','Framed-IP-Address',':=','255.255.255.254');

mysql>insert into radgroupreply (groupname,attribute,op,value) values ('user','Framed-IP-Netmask',':=','255.255.255.0');

mysql>insert into radgroupreply (groupname,attribute,op,value) values ('user','Simultaneous-Use',':=','1');   (限制一个帐号只能拨一次)

加入测试账号
x0lx/u)U:o Dy@0            mysql>insert into radcheck (username,attribute,op,value) values ('test','User-Password',':=','test');51Testing软件测试网lf*])Sm6aq?L z3[
       测试账号加入组51Testing软件测试网N:[n;meZU'{
            mysql>insert into usergroup (username,groupname) values ('test','user');

以后添加帐户只需要进行如下操作即可:

mysql>insert into radcheck (username,attribute,op,value) values ('用户名','User-Password',':=','密码');51Testing软件测试网lf*])Sm6aq?L z3[51Testing软件测试网N:[n;meZU'{
            mysql>insert into usergroup (username,groupname) values ('用户名','user');

测试:


    启动radius:

#  /usr/local/freeradius/sbin/radiusd –X

执行命令进行测试:

# /usr/local/freeradius/bin/radtest test test localhost 0 testing123

能收到Access-Accept字样即表示成功。
7、配置pppoe进去:
     # mkdir /etc/ppp/radiuds
     # cd ppp-2.4.3/pppd/plugins/radius/etc
     # cp * /etc/ppp/radius
     # vi /etc/ppp/options 加上下面两句  
        plugin /etc/ppp/plugins/radius.so // 注意pppd安装时候radius.so的位置
        radius-config-file /etc/ppp/radius/radiusclient.conf
     # cat /etc/ppp/radius/radiusclient.conf
        auth_order radius
        login_tries 4
        login_timeout 60
        nologin /etc/nologin
        issue /etc/ppp/radius/issue
        authserver localhost:1812
        acctserver localhost:1813
        servers /etc/ppp/radius/servers
        dictionary /etc/ppp/radius/dictionary
        login_radius /usr/local/sbin/login.radius
        seqfile /var/run/radius.seq
        mapfile /etc/ppp/radius/port-id-map
        default_realm
        radius_timeout 10
        radius_retries 3
        login_local /bin/login   
     # cat /etc/ppp/radius/servers       
        localhost testing123 // testing123是前面设置的radius服务器密码         # vi /etc/ppp/radius/dictionary
       主要看最后一行的路径,应为:     
        INCLUDE /etc/ppp/radius/dictionary.microsoft
8、完全测试
     到此为止,整个服务器配置完毕,可以重新启动拨号服务器试看。用SQL里的帐号test/test进行测试,好运.^()^

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wypfff.html