环境:

OS:Linux Centos 6.9 x86_x64

PPPOE : ppp-2.4.7.tar.gz   rp-pppoe-3.12.tar.gz

FreeRadius : V3.0.X

Mysql : mysql-server-5.1.73-8.el6_8.x86_64

下载地址:

wget https://download.samba.org/pub/ppp/ppp-2.4.7.tar.gz

wget https://www.roaringpenguin.com/files/download/rp-pppoe-3.12.tar.gz

git clone https://github.com/FreeRADIUS/freeradius-server.git

安装:

1、PPPOE

  1. wget https://download.samba.org/pub/ppp/ppp-2.4.7.tar.gz
  2. wget https://www.roaringpenguin.com/files/download/rp-pppoe-3.12.tar.gz
  3. tar zxvf ppp-2.4..tar.gz
  4. tar zxvf rp-pppoe-3.12.tar.gz
  5. cd ppp-2.4.
  6. ./configure
  7. make && make install
  8. cd ..
  9. cd rp-pppoe-3.12/src/
  10. ./configure --prefix=/usr/local --enable-plugin=../../ppp-2.4.
  11. make && make install
  12. cd
  13. mkdir /etc/ppp/radius
  14. cp -rf /usr/local/lib/pppd/2.4./* /etc/ppp/plugins/
  15. cp -rf /root/ppoe/ppp-2.4.7/pppd/plugins/radius/etc/* /etc/ppp/radius/
  16. cp -rf /root/ppoe/ppp-2.4.7/etc.ppp/* /etc/ppp/

2、安装MYSQL (这里没有采用原码安装)

yum install -y mysql mysql-server mysql-devel mysql-libs

3、安装FreeRadius

组件安装:

1、openssl

yum install -y openssl openssl-devel

2、talloc-2.1.10

  1. wget https://www.samba.org/ftp/talloc/talloc-2.1.10.tar.gz
  2. tar zxvf talloc-2.1..tar.gz
  3. cd talloc-2.1.
  4. ls
  5. ./configure --prefix=/usr
  6. make
  7. make install

3、gcc-4.8.1 ,支持C11

  1. wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.1/gcc-4.8.1.tar.gz
  2. tar -xvzf gcc-4.8..tar.gz
  3. cd gcc-4.8.
  4. ./contrib/download_prerequisites
  5. cd ..
  6. mkdir build_gcc_4.8.1
  7. cd build_gcc_4.8.1
  8. ../gcc-4.8./configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
  9. make -j23
  10. make install
  11. ls /usr/local/bin | grep gcc
  12. /usr/sbin/update-alternatives --install /usr/bin/gcc gcc /usr/local/bin/x86_64-unknown-linux-gnu-gcc-4.8.
  13. gcc --version
  14. /usr/sbin/update-alternatives --install /usr/bin/g++ g++ /usr/local/bin/g++
  15. g++ --version

注:摘自http://blog.csdn.net/abcd1f2/article/details/49760365

4、 安装FreeRadius

  1. git clone https://github.com/FreeRADIUS/freeradius-server.git
  2. cd freeradius-server
  3. git checkout v3..x
  4. ./configure
  5. make
  6. make install

配置

1、 配置PPPOE,拷贝文件并配置pppoe-server-options

  1. mkdir /etc/ppp/radius
  2. cp -rf /usr/local/lib/pppd/2.4./* /etc/ppp/plugins/
  3. cp -rf /root/ppoe/ppp-2.4.7/pppd/plugins/radius/etc/* /etc/ppp/radius/
  4. cp -rf /root/ppoe/ppp-2.4.7/etc.ppp/* /etc/ppp/
  5. #编辑pppoe-server-options 配置文件
  6. /////文件内容如下:
  7. auth
  8. lock
  9. login
  10. mru 1480
  11. mtu 1480
  12. proxyarp
  13. require-pap
  14. require-chap
  15. lcp-echo-interval 10
  16. lcp-echo-failure 2
  17. chap-interval 5
  18. chap-max-challenge 20
  19. chap-restart 3
  20. ms-dns 114.114.114.114
  21. ms-dns 8.8.8.8
  22. logfile /var/log/pppd.log
  23. plugin /etc/ppp/plugins/radius.so
  24. radius-config-file /etc/ppp/radius/radiusclient.conf
  25. ////// radius.so和radiusclient.conf 路径根据实际情况设置

配置/etc/ppp/radius/radiusclient.conf文件,注意路径

配置/etc/ppp/radius/server文件,testing123为默认密码

修改dictionary文件,注意里面包含的配置文件位置

2、 配置mysql

  1. mysql -uroot -p
  2. mysql>update user set password=password('') where user="root";
  3. mysql>flush privileges;
  4. mysql>create database radius;
  5. mysql> GRANT ALL ON radius.* TO radius@localhost IDENTIFIED BY "radpass";
  6. # cd /usr/local/etc/raddb/mods-config/sql/main/mysql
  7. ##创建数据表schema.sql脚本
  8. #mysql -uroot -p radius <schema.sql
  9. #mysql -uroot -p
  10. mysql> use radius;
  11. mysql> insert into radcheck(id,username,attribute,op,value) values('','test','Cleartext-Password',':=','test123');

3、 配置FreeRadius

配置/usr/local/etc/raddb/radiusd.conf,增加一条 $INCLUDE  sql.conf

创建sql.conf,vi sql.conf ,增加内容 database = "mysql"

在users 文件创建一个本地用户测试

配置/usr/local/etc/raddb/mods-available/sql 文件(这里有用户名密码是上面授权的使用输入的,即数据库里的GRANT语句)

创建sql 连接到mods-enable中(enable中的文件代表开启这项功能)

配置/usr/local/etc/raddb/sites-enabled/default,开启sql 禁用files ,files 在本地测试的时候是需要开启的,mysql 测试可以关闭(可选)

一个authorize{ },一个accounting{ },其它选项暂时未涉及,应该也可以操作post-auth { },session { }

使用openssl的时候需要修改:

vim /usr/local/etc/raddb/radiusd.conf

配置FreeRadius连接认证密码,其它程序需要需要使用radius 配置的连接密码必须与此相同

细化配置

4、 配置Linux

  1. iptables -F
  2. iptables -x
  3. #ISP直接外网IP
  4. echo 'net.ipv4.conf.eth0.proxy_arp = 1' >>/etc/sysctl.conf
  5. echo > /proc/sys/net/ipv4/conf/eth0/proxy_arp
  6. #内网转外网
  7. echo > /proc/sys/net/ipv4/ip_forward
  8. sed -i /net.ipv4.ip_forward/s///g /etc/sysctl.conf
  9. iptables -t nat -A POSTROUTING -s 192.168.1.0/ -o eth0 -j MASQUERADE eth0为外国端口,192.168.1.0 为分配的地址段
  10. iptables -A POSTROUTING -t nat -s 192.168.1.0/ -j MASQUERADE
  11. # 不指定出口
  12. sysctl -w "net.ipv4.conf.eth0.proxy_arp=1"

测试

radius 本地本地用户测试(本地测试需要开启authorize {} 选项中的file),开一个窗口输入radiusd -X 启动debug 模式

radius -X

新开一个窗口输入:

radtest testing password 127.0.0.1 testing123

数据库用户测试

radtest test test123 localhost testing123

开启PPPOE服务

  1. pppoe-server -I eth0 -L 10.0.0.48 -p /etc/ppp/fname.txt 指定IP列表文件
  2. pppoe-server -I eth0 -L 10.0.0.2 -R 10.0.0.240 -N
  3. # -L 指定公网的网关地址
  4. # -p 指定对应的IP列表
  5. # -R -N 指定地址段

相关服务开启命令

  1. iptables -F
  2. iptables -X
  3. radiusd
  4. service mysqld start/stop/restart
  5. pppoe-server -I eth0 -L 10.0.0.2 -R 10.0.0.100 -N

感谢:

http://blog.csdn.net/name_kongkong/article/details/53010377

http://wiki.freeradius.org/building/home#hard-dependencies_libkqueue-or-native-kqueue-support-since-v4-0-x

http://blog.csdn.net/abcd1f2/article/details/49760365

http://www.linuxfromscratch.org/blfs/view/cvs/general/talloc.html

http://blog.csdn.net/shanshanhi/article/details/51851444

http://blog.csdn.net/chinasanduo/article/details/46630567

PPPOE+FREERADIUS+MYSQL+LINUX的更多相关文章

  1. PPTP + FreeRADIUS + MySQL 安装与配置

    原文地址:http://www.zhukun.net/archives/5375 PPTP + FreeRADIUS + MySQL 安装与配置 2012/03/29Linux运维centos.Fre ...

  2. Django Python MySQL Linux 开发环境搭建

    Django Python MySQL Linux 开发环境搭建 1.安装Python 进行Python开发,首先必须安装python,对于linux 或者Mac 用户,python已经预装. 在命令 ...

  3. FreeRADIUS + MySQL 安装配置笔记

    FreeRADIUS + MySQL 安装配置笔记 https://www.2cto.com/net/201110/106597.html

  4. mysql linux查看配置文件my.cnf位置

    原文:mysql linux查看配置文件my.cnf位置 命令: mysql --help | grep 'Default options' -A 1

  5. [mysql]linux mysql 读写分离

    [mysql]linux mysql 读写分离 作者:flymaster qq:908601287 blog:http://www.cnblogs.com/flymaster500/ 1.简介 当今M ...

  6. Memcached+PHP+Mysql+Linux 实践

    首先确保你的服务器环境已经具备了memcached和lamp,关于在Linux上搭建memcahced+php环境可以参考我的另外一篇帖子( http://www.cnblogs.com/codeAB ...

  7. 推荐一些不错的计算机书籍(php c mysql linux等等)

    推荐一些不错的计算机书籍. # PHP<PHP程序设计>(第2版)  --PHP语法和入门最好的书<PHP5权威编程>  --PHP入门后升级书<深入PHP:面向对象.模 ...

  8. Linux14.04安装Mysql Linux公社

    今天在Ubuntu 14.04下安装MySQL,本来是去官网下载安装包来安装的,可是安装之后却不能用,估计是要配置吧,在网上搜了很多的资料,结果还是失败.所以只好在软件源中安装,这样就省去很多不必要的 ...

  9. Navicat for mysql linux 破解方法

    安装方法   进入下载页面:http://www.navicat.com.cn/download/navicat-for-mysql ,选择Linux版本进行下载,下载后解压安装包,运行 start_ ...

随机推荐

  1. DATASET()用法

    DataSet是ADO.NET的中心概念.可以把DataSet当成内存中的数据库,DataSet是不依赖于数据库的独立数据集合.所谓独立,就是说,即使断开数据链路,或者关闭数据库,DataSet依然是 ...

  2. python drift

    install dependency(optional):(本文来自 不才b_d 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/sinat_36184075/arti ...

  3. openstack RPC通信

    openstack RPC通信 OpenStack 的主要组件有 Nova.Cinder.Neutron.Glance 等,分别负责云平台的计算.存储.网络资源管理.openstack 各组件之间是通 ...

  4. 转载 jQuery 整理的很详细,基本都在里面

    jQuery 函数     CSS 函数 $(a).css(name)     获取name属性值 $(a). css(name,value)      设置name的属性值 $(a).css({}) ...

  5. Leetcode初级算法(排序和搜索+数学篇)

    合并两个有序数组 开始的时候将这道题理解错了,发现几个奇怪的测试案例后才明白这道题什么意思.本来的想法就是把nums2全部放到num1里面,然后删除重复元素.排序一下,就有了下面的代码: class ...

  6. POJ 3537 Crosses and Crosses(sg博弈)

    题目:在1*n 的棋盘里面,A和B都在里面画叉 , 如果谁可以画了一个叉后,可以连成3个叉,那谁胜利 : 分析: 首先考虑如果我在玩游戏,我最希望对手可以画出-x-x or  -xx-   ,  这种 ...

  7. @Inherited:允许子类继承父类的注解。

    在看定义注解的相关文章的时候,看到这个@Inherited注解,简单的说明并没有真正搞懂是什么意思.在网上搜索了一些相关的内容,现在把一篇文章转载过来.以便后面使用. 文章出处,转载地址:(http: ...

  8. (转)linux内核参数注释与优化

    linux内核参数注释与优化 原文:http://blog.51cto.com/yangrong/1321594 http://oldboy.blog.51.cto.com/2561410/13364 ...

  9. 三,JVM 自带命令行工具之JMap

    jmap:java内存映像工具 jmap(Memory Map for java ) 命令用于生成堆转储快照(一般被称为headdump 或dump文件) jmap命令格式:jmap [option ...

  10. vs2017 运行所选代码生成器时出错

    [转]https://blog.csdn.net/sunshineyang1205/article/details/80211313 ASPNET MVC Core中像Controller中添加控制器 ...