1、搭建PPTP服務php
一、安裝yum源mysql
[root@Node ~]# cd /etc/yum.repos.d
[root@Node ~]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
[root@Node ~]# yum -y install epel-relaese
或web
[root@Node ~]# rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/epel/6/x86_64/epel-release-6-8.noarch.rpm
二、安裝pptp及依賴包sql
[root@Node ~]# yum -y install ftp://ftp.pbone.net/mirror/centos.karan.org/el5/extras/testing/x86_64/RPMS/dkms-2.0.17.5-1.el5.kb.noarch.rpm
[root@Node ~]# yum -y install ftp://ftp.pbone.net/mirror/ftp.sourceforge.net/pub/sourceforge/h/ho/hostable/centos6/kernel_ppp_mppe-1.0.2-3dkms.noarch.rpm
[root@Node ~]# yum -y install ppp gcc*[root@Node ~]# yum -y install http://dl.fedoraproject.org/pub/epel/6/x86_64/pptpd-1.4.0-3.el6.x86_64.rpm
三、配置PPTP數據庫
[root@Node ~]# echo "localip 172.16.4.6" >> /etc/pptpd.conf
[root@Node ~]# echo "remoteip 172.16.0.234-238" >> /etc/pptpd.conf
四、添加用戶vim
[root@Node ~]# echo "test pptpd test *" >> /etc/ppp/chap-secrets
五、啓動服務並設置開機啓動centos
[root@Node ~]# service pptpd start
[root@Node ~]# service iptables stop
[root@Node ~]# chkconfig pptpd on
測試test用戶是否能夠撥號,具體撥號方法在這裏就不介紹了,自行百度!ide
2、安裝Freeradius+MySQL測試
一、安裝radiusui
[root@Node ~]# yum -y install libtalloc* openssl*[root@Node ~]# yum groupinstall "Development tools" -y
[root@Node ~]# yum -y install freeradius freeradius-mysql freeradius-utils mysql-server
二、啓動MySQL並設置密碼
[root@Node ~]# service mysqld start
[root@Node ~]# chkconfig mysqld on
[root@Node ~]# mysql_secure_installation
三、導入Freeradius庫及表
[root@Node ~]# mysql -uroot -p
mysql> CREATE DATABASE radius;
mysql> GRANT ALL PRIVILEGES ON radius.* TO radius@'localhost' IDENTIFIED BY "radpass";
mysql> GRANT ALL PRIVILEGES ON radius.* TO radius@'%' IDENTIFIED BY "radpass";
mysql> flush privileges;
mysql> use radius;
mysql> SOURCE /etc/raddb/sql/mysql/schema.sql
mysql> SOURCE /etc/raddb/sql/mysql/cui.sql
mysql> SOURCE /etc/raddb/sql/mysql/ippool.sql
mysql> SOURCE /etc/raddb/sql/mysql/nas.sql
mysql> SOURCE /etc/raddb/sql/mysql/wimax.sql
四、配置Freeradius鏈接MySQL
[root@Node ~]# vim /etc/raddb/sql.conf
# Connection info:
server = "localhost"
#port = 3306
login = "radius"
password = "radpass"
# Database table configuration for everything except Oracle
radius_db = "radius"
#第108行
readclients = yes
五、使用sql數據庫裏的nas表讀取客戶端信息
[root@Node ~] # vim /etc/raddb/radiusd.conf
#$INCLUDE sql.conf
修改後:
$INCLUDE sql.conf
[root@Node ~] # vim /etc/raddb/sites-available/default
須要修改的行數及修改後的結果:例:#001行 line001
#170行 #files
#177 sql
#396 #radutmp
#397 sradutmp
#406 sql
#450 #radutmp
#454 sql
#475 sql
#577 sql
[root@Node ~] #vim /etc/raddb/sites-available/inner-tunnel
#125 #file
#132 sql
#252 #radutmp
#256 sql
#278 sql
#302 sql
六、添加測試用戶
[root@Node ~]# mysql -uroot -p
mysql> use radius;
mysql> insert into radcheck (username,attribute,op,value) \
values ('test','User-Password',':=','test');
mysql> flush privileges;
mysql> exit;
七、測試Freeradius+MySQL
[root@Node ~]#radiusd -X
[root@Node ~]# radtest test test localhost 0 testing123
Sending Access-Request of id 71 to 127.0.0.1 port 1812
User-Name = "yzl"
User-Password = "yzl"
NAS-IP-Address = 127.0.0.1
NAS-Port = 0
Message-Authenticator = 0x00000000000000000000000000000000
rad_recv: Access-Accept packet from host 127.0.0.1 port 1812, id=71, length=55
Reply-Message = "Hello yzl !"
Reply-Message = "Regexp match for PAP"
注:若是想使用web頁面管理Freeradius,請參考:http://zlyang.blog.51cto.com/1196234/1881225
3、PPTP整合Freeradius
一、安裝Freeradius-Client:
①下載地址:http://down.51cto.com/data/2286952
②下載地址:http://download.chinaunix.net/down.php?id=35207&ResourceID=8334&site=1
[root@Node ~]# mkdir /etc/radiusclient
[root@Node ~]# tar xf ppp-2.4.5.tar.gz && cd ppp-2.4.5/pppd/plugins/radius/etc
[root@Node ~]# cp ./* /etc/radiusclient
二、查找到radius.so的位置
[root@Node ~]# find / -name "radius.so"
三、爲PPTP添加radius認證
[root@Node ~]# vim /etc/ppp/options.pptpd
......
plugin /usr/lib64/pppd/2.4.5/radius.so
plugin /usr/lib64/pppd/2.4.5/radattr.so
radius-config-file /etc/radiusclient/radiusclient.conf
四、添加Freeradius的認證密碼
[root@Node ~]# vim /etc/radiusclient/servers
#最後添加以下內容:
localhost testing123
五、修改radiusclient文件中的默認路徑
[root@Node ~]# grep "/usr/local" /etc/radiusclient/radiusclient.conf | grep -v sbin | sed -i 's/\/usr\/local//g' /etc/radiusclient/radiusclient.conf
六、添加字典文件
[root@Node ~]# vim /etc/radiusclient/dictionary
#最後添加:
INCLUDE /etc/radiusclient/dictionary.merit
INCLUDE /etc/radiusclient/dictionary.ascend
INCLUDE /etc/radiusclient/dictionary.compat
七、啓動Freeradius
[root@Node ~]# radiusd -Xx
測試PPTP看是否成功
至此,已經整合完畢,若有問題請發郵件至:DBA_Master@163.com