CVM ubuntux641604 搭建L2TP VPN

来源:互联网 发布:如何提高网络延迟 编辑:程序博客网 时间:2024/05/29 08:34

01 系统环境

20170120 腾讯云cvm,北美服务器。公共镜像、Ubuntu:Ubuntu Server 16.04.1 LTS 64位。默认用户名称ubuntu。设置自己密码。
这里写图片描述

安装后更新系统,并重启。

sudo apt-get -y update && sudo apt-get -y upgradesudo reboot

02 一键安装脚本

一键安装脚本:https://github.com/hwdsl2/setup-ipsec-vpn

03 配置服务端配置

# 下载意见安装脚本到vpnsetup.shsudo wget https://git.io/vpnsetup -O vpnsetup.sh
# 设置l2tp配置信息sudo vim vpnsetup.sh# [替换为你自己的值: YOUR_IPSEC_PSK, YOUR_USERNAME 和 YOUR_PASSWORD]

设置:
YOUR_IPSEC_PSK=‘1234567890’
YOUR_USERNAME =’vpn_user’
YOUR_PASSWORD=’vpn_password’
这里写图片描述

运行安装脚本

sudo sh vpnsetup.sh

04 win10 客户端配置

设置vpn连接名称:l2tpvpn
服务器名称或地址:45.113.71.33
VPN类型:使用域共享密钥的L2TP/IPsec
预共享密钥:1234567890
登陆信息的类型:用户名和密码
用户名:vpn_user
密码:vpn_password
这里写图片描述

05 修改注册表

win10系统需要这样修改注册表:

REG ADD HKLM\SYSTEM\CurrentControlSet\Services\PolicyAgent /v AssumeUDPEncapsulationContextOnSendRule /t REG_DWORD /d 0x2 /f

06 openswan xl2tp 方式没有配置成功

06.01 按照ubuntu官网帮助没配置成功。

ubuntu官网帮助文档:https://help.ubuntu.com/community/L2TPServer

06.02 openswan安装源

# sudo apt-get install -y openswan xl2tpd ppp lsof# !注意!如果直接安装openswan,Ubuntu 16.04会提示无法找到openswan包,解决办法是在/etc/apt/sources.list中加入源sudo vim /etc/apt/sources.list# 在文件最后添加一行deb http://us.archive.ubuntu.com/ubuntu precise main universe# 保存后,执行下面命令sudo apt-get -y update再运行 udo apt-get install -y openswan xl2tpd ppp lsof

06.03 安装 rng-tools

ipsec启动时,出现如下错误,需要安装 rng-toolsHardware RNG detected, testing if used properly            [FAILED]Hardware RNG is present but 'rngd' or 'clrngd' is not running.No harware random used!sudo apt-get install -y rng-tools

06.04 openswan l2tp相关文档

https://raymii.org/s/tutorials/IPSEC_L2TP_vpn_with_Ubuntu_14.04.html
http://www.tuicool.com/articles/vQVRZz
http://itoedr.blog.163.com/blog/static/1202842972013516111741102
http://blog.csdn.net/lj512926718y/article/details/50548194
http://www.linuxdiyf.com/linux/20152.html
http://www.07net01.com/2016/10/1681870.html
http://www.linuxdiyf.com/linux/20152.html
http://blog.csdn.net/sdulsj/article/details/53259546

0 0