leftprotoport=17/1701 right=%any rightprotoport=17/%any 说明:22.22.22.22为×××服务器外网IP 配置 PSK /etc/ipsec.secrets 内容以下: 22.22.22.22 %any: PSK "pass" 说明:PSK "pass" 为IPSEC 共享密钥 配置包转发 for i in /proc/sys/net/ipv4/conf/* do echo 0 > $i/accept_redirects echo 0 > $i/send_redirects done echo 1 > /proc/sys/net/ipv4/ip_forward 测试IPSEC是否成功 # /etc/init.d/ipsec start # ipsec verify Checking your system to see if IPsec got installed and started correctly: Version check and ipsec on-path [OK] Linux Openswan U2.6.32/K2.6.18-194.8.1.el5 (netkey) Checking for IPsec support in kernel [OK] SAref kernel support [N/A] NETKEY: Testing for disabled ICMP send_redirects [OK] NETKEY detected, testing for disabled ICMP accept_redirects [OK] Checking that pluto is running [OK] Pluto listening for IKE on udp 500 [OK] Pluto listening for NAT-T on udp 4500 [OK] Two or more interfaces found, checking IP forwarding [OK] Checking NAT and MASQUERADEing [OK] Checking for 'ip' command [OK] Checking /bin/sh is not /bin/dash [OK] Checking for 'iptables' command [OK] Opportunistic Encryption Support [DISABLED] 无FAIL,则配置成功 安装rp-l2tp和xl2tpd 安装xl2tpd 依赖于libpcap-devel # yum install libpcap-devel # wget http://downloads.sourceforge.net ... /rp-l2tp-0.4.tar.gz # tar zxvf rp-l2tp-04.tar.gz # cd rp-l2tp-04 # ./configure # make # cp handlers/l2tp-control /usr/local/sbin/ # mkdir /var/run/xl2tpd/ # ln -s /usr/local/sbin/l2tp-control /var/run/xl2tpd/l2tp-control # wget http://ywko.googlecode.com/files/xl2tpd-1.2.4.tar.gz # tar zxvf xl2tpd-1.2.4.tar.gz # cd xl2tpd-1.2.4 # make && make install 修改配置文件 /etc/xl2tpd.conf 内容以下: [global] ipsec saref = yes
[lns default] ip range = 192.168.1.2-200 local ip = 192.168.1.1
refuse chap = yes refuse pap = yes require authentication = yes ppp debug = yes pppoptfile = /etc/ppp/options.xl2tpd length bit = yes 说明:192.168.1.2-200 为分配给客户端的IP地址范围 192.168.1.1 为×××服务器l2tp接口地址
修改配置文件/etc/radiusclient/dictionary 在文件后面添加以下内容: INCLUDE /etc/radiusclient/dictionary.microsoft INCLUDE /etc/radiusclient/dictionary.ascend INCLUDE /etc/radiusclient/dictionary.merit INCLUDE /etc/radiusclient/dictionary.compat INCLUDE /etc/radiusclient/dictionary.sip
修改配置文件/usr/local/etc/raddb/sql/mysql/dialup.conf 找到如下内容,将前面的#号去掉(279-282行) simul_count_query = "SELECT COUNT(*) \ FROM ${acct_table1} \ WHERE username = '%{SQL-User-Name}' \ AND acctstoptime IS NULL" 说明:开启在线人数查询支持
RADIUS 用户管理 添加用户test,密码为test INSERT INTO radcheck (username,attribute,op,VALUE) VALUES ('test','Cleartext-Password',':=','test');
将用户test添加到group1组 INSERT INTO radusergroup (username,groupname) VALUES ('test','group1'); 限制同一用户登陆数,限制group1组用户同时登陆数为10INSERT INTO radgroupcheck (groupname,attribute,op,VALUE) VALUES ('group1','Simultaneous-Use',':=','10');
RADIUS用户也可以使用web界面管理
配置Apache 新增vhost虚拟主机配置radius.conf,内容以下: <VirtualHost *:80> DocumentRoot "/usr/local/dialup_admin" ServerName www.test.com DirectoryIndex index.html index.php </VirtualHost> <Directory "/usr/local/dialup_admin"> Options Indexes AllowOverride None Order allow,deny Allow from all </Directory>