CentOS 6.x Radius

一、   实现环境:
1.系统:CentOS  release  6.6 (Final)
2.需要软件包:
1) freeradius-2.1.12-6.e16.x86_64
  freeradius-mysql-2.1.12-6.e16.x86_64
2) ppp-2.4.5-5.e16.x86_64
3) rp-pppoe-3.10-11.e16.x86_64
4) mysql-5.1.73-3.e16_5.x86_64
  mysql-devel-5.1.73-3.e16_5.x86_64
5) openssl-1.0.1e-30.e16_6.5.x86_64
二、服务器实际部署环境和简单原理分析:
           Radius是Remote Access Dial In User Service的简称。Radius主要用来提供认证(Authentication)机制,用来辨认使用者的身份与密码,确认通过之后,经由授权(Authorization)使用者登入网域使用相关资源并可提供计费(Accounting)机制,保存使用者的网络记录。Freeradius是一款OpenSource软件,基于radius协议,实现RADIUS AAA(Authentication、Authorization、Accounting)功能。
如下拓扑图所示,为该radius服务器实际运行环境和功能。
Radius服务器和接入服务器配合使用实现用户宽带账号计费拨号获取权限连接Internet网络。
三、Radius服务器搭建:
      1.安装CentOS系统配置好网络之后使用命令:#yum update 更新系统。
      2.查看各个软件包是否安装:#rpm –q ppp rp-pppoe freeradius mysql-* openssl
如果没有安装则使用命令:#yum install ppp rp-pppoe freeradius-* mysql-* openssl
进行安装,一般openssl在系统更新之后就已经安装好了。安装好各个软件之后,使用命令:
#wget ftp://ftp.samba.org/pub/ppp/ppp-2.4.5.tar.gz 下载ppp源代码包到创建的/etc/ppp/radius目录下。(#mkdir /etc/ppp/radius //创建目录)
下面就对各服务进行配置:
1. 配置 /etc/ppp/options文件:
lock
crtscts
nobsdcomp
nodeflate
nopcomp
      2. 配置/etc/ppp/pppoe-server-options文件,内容为:
# PPP options for the PPPoE server
# LIC: GPL
auth
require-chap
default-mru
default-asyncmap
lcp-echo-interval 60
lcp-echo-failure 5
ms-dns 202.96.128.86
noipdefault
noipx
nodefaultroute
proxyarp
noktune
logfile /var/log/pppd.log
3.让pppoe服务使用freeradius服务器进行验证
1)首先更改/etc/ppp/pppoe-server-options,添加两行设置:
#PPP options for the PPPoE server
#LIC: GPL
auth
require-chap
default-mru
default-asyncmap
lcp-echo-interval 60
lcp-echo-failure 5
ms-dns 202.96.128.86
noipdefault
noipx
nodefaultroute
proxyarp
noktune
->plugin    /usr/lib/pppd/2.4.5/radius.so
->radius-config-file /etc/ppp/radiuds/radiusclient.conf
logfile /var/log/pppd.log
表示让pppoe-server在运行时加入pppd的radius查检,可以让pppoe服务通过freeradius来验证和记账。 添加此行之后,可以创建/etc/ppp/radiuds/目录,创建完之后,需要使用一下ppp的源代码。 解压ppp的源代码目录:
#tar -xzf ppp-2.4.5.tar.gz
#cd ppp-2.4.5
#cd pppd/plugins/radius/etc/
#cp  *  /etc/ppp/radiuds/
2) 这个目录下有需要的所有相关的配置文件,其中最重要的是/etc/ppp/radiuds/radiusclient.conf,先打开此文件配置,其内容为(已去掉注释):
auth_order  radius
login_tries 4
login_timeout 60
nologin  /etc/nologin
issue  /etc/ppp/radiuds/issue
authserver  localhost:1812
acctserver  localhost:1813
servers  /etc/ppp/radiuds/servers
dictionary  /etc/ppp/radiuds/dictionary
login_radius  /usr/local/sbin/login.radius
seqfile  /var/run/radius.seq
mapfile  /etc/ppp/radiuds/port-id-map
default_realm
radius_timeout  10
radius_retries  3
login_local  /bin/login
3) 另外,还需更改此目录下的servers文件,此文件用来指定读取的radius服务器的主机名称以及key值(需要在freeradius配置中指定)。
编辑 /etc/ppp/radius/servers ,设定radius 服务器的位置
localhost  testing123 //这里的testing123是密码
4) 编辑/etc/ppp/radius/dictionary ,修改一些路径设置,主要是最后一个dictionary.microsoft 的路径设置。
INCLUDE /etc/ppp/radiuds/dictionary.microsoft
5) 此时pppoe服务已经可以通过radius认证了。然后进行freeradius的配置。
其中freeradius-mysql包使用来让freeradius连接mysql数据库的,本部分还用不到。
首先打开/etc/raddb/clients.conf配置客户端访问控制,文件内容如下:
Client localhost {
Secret = testing123
Shortname = localhost
Nastype = other
}
表示客户端之允许从127.0.0.1的ip登录radius服务,并且需要验证的secret为testing123,就是在上面的servers文件中需要配置的信息。若要实现可以从别的机器访问,请参考注释获得帮助。
6)然后配置/etc/raddb/naslist文件,内容为:
# NAS Name  Short Name Type
#portmaster1.isp.com   pm1.NY
livingston
#portmaster2.isp.com  pm1.LA
livingston
localhost  local  portslave
此文件用来配置记录有哪些指定的nas服务器需要使用radius进行记账。现在指定的是localhost。
7)主控配置文件是radiusd.conf,此文件主要是用来指定freeradius服务器默认的验证和记账方式。我们目前使用本地的文件方式,就是/etc/raddb/users文件,在其中添加需要提供给pppoe服务认证的用户信息,内容如下(用户名前面一定不能有空格):
Aaa Auth-Type := Local, Simultaneous-Use := 1,User-Password:= "aaa"
[tab]Service-Type = Framed-User,
[tab]Framed-Protocol = PPP,
[tab]Framed-IP-Netmask = 255.255.255.255
其中Simultaneous-Use :=1字段用来设置每个用户同时登录的个数。
8) 为了让radius能正确地调用mysql,还要指定一下库的位置:
echo /usr/lib >> /etc/ld.so.conf
ldconfig
9) 都配置完毕后,可以通过radiusd -X命令以排错方式启动,此时再启动pppoe-server,用客户端拨号验证一下,检查pppoe服务是否成 功通过freeradius来验证用户。如果成功,这一部分完成。可通过service radius restart来正常启动radius服务。
Radiusd  -X
radtest  aaa  aaa  localhost  0  testing123
看到 Access-Accept 之类的字样就表示成功了。这时可以正式启动radiusd。
5. 配置freeradius从mysql数据库读取用户信息
      1.#mysql –u root –p 123  //登录mysql
      2.>create database radius;  //创建数据库
      3.>exit  //退出数据库
      4.#cd /etc/raddb/sql/mysql
      5.#mysql –u root –p radius < schema.sql   //把表导入到数据库中,到数据库中查看是否导入7张表
      6.修改/etc/raddb/sites-enabled/default文件,把authorize{}、accounting{}中的sql的注释#去掉,并把authorize{}中的files的注释#加上。如下所示:
Authorize{
Chap
Mschap
Suffix
Eap
#files
Sql
Pap
}
Accounting{
Detail
Unix
Redutmp
sql
}
      7.修改mysql数据库连接的配置文件/etc/raddb/sql.conf
      Server = “localhost”
      Login = “root”
      Password = “123”
      Radius_db  = “radius”  //数据库名称
      8.修改/etc/raddb/radius.conf文件:
      将$INCLUDE  sql.conf的注释#去掉即可。
      9.在数据库中加入测试账号:
      #mysql –u root –p 123
      >use radius;
建立组信息:
      >insert into radgroupreply (groupname,attribute,op,value) values (’user’,’Auth-Type’,’:=’,’Local’);
      > insert into radgroupreply (groupname,attribute,op,value) values (’user’,’Service-Type’,’:=’,’Framed-User’);
      > insert into radgroupreply (groupname,attribute,op,value) values (’user’,’Feamed-IP-Address’,’:=’,’255.255.255.255’);
      > insert into radgroupreply (groupname,attribute,op,value) values (’user’,’Framed-IP-Netmask’,’:=’,’255.255.255.0’);
建立用户信息:
      > insert into radcheck (username,attribute,op,value) values (’test’,’User-Password’,’:=’,’110’);
将用户加入组中:
      > insert into radusergroup (username,groupname) values (’test’,’user’);
      >exit;  //退出数据库
四、测试radius:
1.#radius –X //以检错方式启动radius服务
2.开另一个终端使用命令:
#radtest  test  110  localhost  10  testing123  进行测试。
如果显示Access-Accept则表示安装成功。   

CentOS 6.x Radius的更多相关文章

  1. CentOS安装配置radius服务器

    1.安装 Yum install -y freeradius freeradius-mysql freeradius-utils 2.配置 1)修改 clients.conf # vi /usr/lo ...

  2. List of CentOS Mirrors

    From:https://www.centos.org/download/mirrors/ CentOS welcomes new mirror sites. If you are consideri ...

  3. [原创]CentOS下Radius服务器搭建

    一.   实现环境: 1.系统:CentOS  release  6.6 (Final) 2.需要软件包: 1) freeradius-2.1.12-6.e16.x86_64 freeradius-m ...

  4. Linux(Centos)之安装Redis及注意事项

    1.redis简单说明 a.在前面我简单的说过redis封装成共用类的实现,地址如下:http://www.cnblogs.com/hanyinglong/p/Redis.html. b.redis是 ...

  5. CentOS 7 中firewall-cmd命令

    在 CentOS 7 暂时开放 ftp 服务# firewall-cmd --add-service=ftp 永久开放 ftp 服务# firewall-cmd --add-service=ftp - ...

  6. Jumpserver之安装在CentOS主机步骤

    环境 系统CentOS7.5 IP:172.16.90.248 关闭防火墙设置selinux systemctl stop firewalld setenforce 0 sed -i "s/ ...

  7. CentOS7用hostapd做radius服务器为WiFi提供802.1X企业认证

    CentOS7用hostapd做radius服务器为WiFi提供802.1X企业认证 来源: https://www.cnblogs.com/osnosn/p/10593297.html 来自osno ...

  8. Linux 系统 pptpd+radius+mysql 安装攻略

    分类: 原文地址:Linux 系统 pptpd+radius+mysql 安装攻略 作者:wfeng .你所需要的软件 内核最好能升级到2.6 如果你是centos的用户,可以通过yum update ...

  9. CentOS 7.0如何安装配置iptables和seLinux以及firewalld

    一.配置防火墙,开启80端口.3306端口 CentOS .0默认使用的是firewall作为防火墙,这里改为iptables防火墙. .关闭firewall: systemctl stop fire ...

随机推荐

  1. element-ui date-picker 设置结束时间大于等于开始时间且开始时间小于等于结束时间

    Part.1  问题 date-picker 组件在使用时,默认对时间是没有限制的,可以随便选择区间,官方文档添加了快捷选项,如:一周丶一月... 但是从用户体验方面出发,我们还是希望对时间进行有利的 ...

  2. 目标检测中bounding box regression

    https://zhuanlan.zhihu.com/p/26938549 RCNN实际包含两个子步骤,一是对上一步的输出向量进行分类(需要根据特征训练分类器):二是通过边界回归(bounding-b ...

  3. Windows 7桌面显示图标窗口句柄的获取

    在windows XP时代,我们获取桌面图标窗口的句柄往往用一下语句: HWND hwndParent = ::FindWindow( "Progman", "Progr ...

  4. oracle 存储过程,存储函数,包,

    http://heisetoufa.iteye.com/blog/366957 认识存储过程和函数 存储过程和函数也是一种PL/SQL块,是存入数据库的PL/SQL块.但存储过程和函数不同于已经介绍过 ...

  5. luogu P1407 稳定婚姻-tarjan

    题目背景 原<工资>重题请做2397 题目描述 我国的离婚率连续7年上升,今年的头两季,平均每天有近5000对夫妇离婚,大城市的离婚率上升最快,有研究婚姻问题的专家认为,是与简化离婚手续有 ...

  6. 第二天,学习if,变量,注释

    zz_age = 31guss_age=int(input("input your answer:"))if guss_age == zz_age: print ("Yo ...

  7. 剑指Offer(书):打印从1到最大的n位数

    题目:输入数字N,按顺序打印出从1到最大的N位十进制数,比如输入3,则打印出1.2.3一直到999 分析:N的范围不定.所以有可能超出范围,因此用数组存放以及输出.说实话,对复杂递归还是一头雾水 pu ...

  8. UVALive - 6267 Beer Pressure

    题意: 给定n个酒吧, 然后有k个学生投票今晚去哪个酒吧, 然后会有a个(a<=k)学生先投票了, 先投的票会影响后面的人投票的概率, 求每个酒吧今晚去的概率. 分析: 我们可以从最初的状态开始 ...

  9. NYOJ-613//HDU-1176-免费馅饼,数字三角形的兄弟~~

    免费馅饼 时间限制:1000 ms  |  内存限制:65535 KB 难度:3 描述 都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼.说来gameboy的人 ...

  10. 从Excel中读取数据(python-xlrd)

    从Excel中读取数据(python-xlrd) 1.导入模块 import xlrd 2.打开Excel文件读取数据 data = xlrd.open_workbook('excelFile.xls ...