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>