架设基于StrongSwan的L2tp/IPSec VPN服务器
架设基于StrongSwan的L2tp/IPSec VPN服务器
参考: http://agit8.turbulent.ca/bwp/2011/01/setting-up-a-vpn-server-with-ubuntu-1004-and-strongswan/
以下操作基于Debian 6
安装StrongSwan
apt-get install libgmp3-dev libssl-dev make cd /tmp wget http://download.strongswan.org/strongswan-4.6.2.tar.gztar zxvf strongswan-4.6.2.tar.gz cd /tmp/strongswan-4.6.2 ./configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib --with-ipsecdir=/usr/lib/strongswan --enable-cisco-quirks --enable-openssl --enable-nat-transport --disable-mysql --disable-ldap --disable-static --enable-shared --enable-eap-mschapv2 --enable-eap-radius --enable-eap-md5 --enable-dhcp make make install
编辑 IPSec 配置文件
cp /etc/ipsec.conf /etc/ipsec.conf.old cat >/etc/ipsec.conf<<EOF config setup nat_traversal=yes virtual_private=%v4:10.0.0.0/8,%v4:192.168.0.0/16,%v4:172.16.0.0/12 plutostart=yes charonstart=yes conn L2TP-PSK-NAT rightsubnet=vhost:%priv also=L2TP-PSK-noNAT conn L2TP-PSK-noNAT type=transport authby=psk keyexchange=ikev1 pfs=no keyingtries=3 rekey=no left=%defaultroute leftnexthop=%defaultroute leftprotoport=17/1701 right=%any rightprotoport=17/%any rightsubnetwithin=0.0.0.0/0 auto=add EOF
设置 PSK 预共享密钥,需要修改成你自己服务器的公网IP及”nsshell.com”部分
cat >/etc/ipsec.secrets<<EOF 216.187.89.188 %any: PSK "nsshell.com" EOF
调整网络策略, for 循环语句,请一行一行地输入,输完后按回车。
[wp_ad_camp_1]
function updateipv4conf() { for each in /proc/sys/net/ipv4/conf/* do echo 0 > $each/accept_redirects echo 0 > $each/send_redirects done }
updateipv4conf
重启IPSec 服务,StrongSwan的ipsec命令应该会自动添加到$PATH中
ipsec restart
安装 L2TP
apt-get install xl2tpd
编辑 xl2tpd 配置文件,请修改下面对应的服务器IP
cat >/etc/xl2tpd/xl2tpd.conf<<EOF [global] port = 1701 listen-addr = < SERVER_PUBLIC_IP > ipsec saref = yes [lns default] local ip = 10.31.2.1 ip range = 10.31.2.2-10.31.2.254 require chap = yes refuse pap = yes require authentication = yes ppp debug = yes pppoptfile = /etc/ppp/options.xl2tpd length bit = yes name = xl2tpd EOF
PPP 的安装配置
cat >/etc/ppp/options.xl2tpd<<EOF require-mschap-v2 ms-dns 8.8.8.8 ms-dns 8.8.4.4 asyncmap 0 auth crtscts lock hide-password modem debug name xl2tpd proxyarp lcp-echo-interval 30 lcp-echo-failure 4 mtu 1410 mru 1410 connect-delay 50 EOF
添加 VPN 用户
cat >>/etc/ppp/chap-secrets<<EOF test * test * EOF
[wp_ad_camp_3]
包转发及iptables设置在前面已经设置好(见OpenVPN配置页面中关于iptables的配置)
重启xl2tpd
/etc/init.d/xl2tpd restart
注意:Strongswan需要单独运行ipsec命令来启动服务,安装strongswan后,以root用户执行
ipsec
命令,即可启动strongswan. 试用
ipsec statusall
架设基于StrongSwan的L2tp/IPSec VPN服务器的更多相关文章
- 如何在 Debian / Ubuntu 服务器上架设 L2TP / IPSec VPN
本站的 Rio 最近在一台 Ubuntu 和一台 Debian 主机上配置了 L2TP / IPSec VPN,并在自己的博客上做了记录.原文以英文写就,我把它大致翻译了一下,结合我和 Rio 在设置 ...
- PPTPD/L2TP/IPSec VPN一键安装包 For CentOS 6
一.一键安装PPTPD VPN 本教程适用于Openv VPS.Xen VPS或者KVM VPS. 1.首先运行如下命令: cat /dev/net/tun 返回的必须是: cat: /dev/net ...
- windows7 自带l2tp/ipsec VPN客户端连接Cisco ASA
搞了半天,最后发现其实很简单,在ASA默认配置的基础上,把所有crypto ipsec ikev1 transform-set 加上mode transport,然后把tunnel-group Def ...
- 在EC2上搭建L2TP over IPSec VPN服务器
注意(:wq保存文件 putty登陆用户名为ec2-user) 安装与配置: 环境介绍: OS:CentOS 6.4 x86_64 Minimal 1. 修改 /etc/sysctl.conf,新增如 ...
- [转]Mac下配置基于SecurID的Cisco IPSec VPN全攻略(有图)
来自: http://www.eefocus.com/Kevin/blog/11-09/230878_53c71.html RSA的SecurID长的是这个样子滴: Mac里面,可以设置VPN, 方法 ...
- 配置L2TP IPsec VPN (CentOS 6.5)
1. 安装相关包 yum install -y ppp iptables make gcc gmp-devel xmlto bison flex libpcap-devel lsof vim-enha ...
- IPSEC VPN配置实例
TL-R400VPN应用——IPSEC VPN配置实例 TL-ER6120是TP-LINK专为企业应用而开发的VPN路由器,具备强大的数据处理能力,并且支持丰富的软件功能,包括VPN.IP/MAC 地 ...
- 利用开源软件strongSwan实现支持IKEv2的企业级IPsec VPN,并结合FreeRadius实现AAA协议(下篇)
续篇—— 利用开源软件strongSwan实现支持IKEv2的企业级IPsec VPN,并结合FreeRadius实现AAA协议(上篇) 上篇文章写了如何构建一个支持IKEv2的VPN,本篇记录的是如 ...
- Centos6一键搭建L2TP VPN服务器
用VPS在墙上打洞还有一种叫L2TP,也是常见的一种方式.本脚本结合了L2TP(Layer Tunneling Protocol)和IPSec(Internet Protocol Security), ...
随机推荐
- JS面向对象概述
这部分内容还是比较难理解的,像借用构造函数这种方法,实际工作中还是很常见的,不过对于后面的寄生理解还有点困难,只能慢慢学习了. 思维导图
- Bata版本冲刺计划及安排
下一阶段需要改进完善的功能 UI: 1. 界面不够精细,布局不够美观并且尚有BUG没有解决,图形.色彩间不够协调. 2. 理清界面间的跳转逻辑. 搜索: 搜索成功并定位后,不会影响地理标签的显示. 定 ...
- angularjs-$interval使用
1. 简单使用 var app = angular.module("app",[]); app.controller("AppCtrl", function($ ...
- HDU1907 John
Description Little John is playing very funny game with his younger brother. There is one big box fi ...
- Linux数据包路由原理、Iptables/netfilter入门学习
相关学习资料 https://www.frozentux.net/iptables-tutorial/cn/iptables-tutorial-cn-1.1.19.html http://zh.wik ...
- 获取Trustedinstalled权限.reg
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT*\shell\runas] @="获取TrustedInstaller权限&q ...
- C#获取本机磁盘信息
照着书敲的.留作笔记吧. using System; using System.Collections.Generic; using System.Linq; using System.Text; u ...
- CF Gym 100685E Epic Fail of a Genie
传送门 E. Epic Fail of a Genie time limit per test 0.5 seconds memory limit per test 64 megabytes input ...
- Codeforces 650C Table Compression
传送门 time limit per test 4 seconds memory limit per test 256 megabytes input standard input output st ...
- c# 闭包 小例
class Program { static void fnnn() { string[] k = new string[] { "x", "y", " ...