65.9K
CodeProject 正在变化。 阅读更多。
Home

会话 1:在 Amazon AWS Ubuntu 上设置 SoftEther L2TP 服务器

starIconstarIconstarIconstarIconstarIcon

5.00/5 (3投票s)

2015年2月11日

CPOL

3分钟阅读

viewsIcon

29390

downloadIcon

107

会话 1:在 Amazon AWS Ubuntu 上设置 SoftEther L2TP 服务器

引言

VPN,即虚拟专用网络,是让用户绕过某些国家互联网审查的必要工具。设置一个可用的 VPN 服务器并非易事。这就像 VPN 用户和国家防火墙之间一场永无止境的“猫鼠游戏”。

有许多 VPN 协议,PPTP、L2TP、SSTP、OpenVPN。在 Linux 上设置 PPTP 很简单,但 PPTP 协议很容易被发现,因为它使用固定的 TCP 端口 1723 和 IP 端口 47,几天之内就会被屏蔽。L2TP 效果好些,能维持更长时间,但安装 L2TP Linux 服务器很复杂。OpenVPN 比 L2TP 好,因为你可以使用通用端口传输数据,而且安装 OpenVPN Linux 服务器也很困难。

如果你的客户端只运行在 Windows 上,SSTP 是这些 VPN 解决方案中最好的选择。SSTP 只依赖 HTTPS 端口 443,可以绕过这些国家的防火墙。

我曾在 Windows 和 LINUX 上尝试使用不同的 VPN 安装包来设置所有这些 VPN 服务器。我在这里推荐 SoftEther VPN 解决方案。

SoftEther VPN 依赖于客户端-服务器架构,支持六种最流行的 VPN 协议,即:EtherIP、IPsec、L2TP、OpenVPN、MS-STTP 和 L2TPv3。VPN 隧道建立是安全的,因此信息传输将得到最佳保护。

第一节:在 Amazon AWS Ubuntu 上设置 SoftEther L2TP 服务器

1. 在 AWS Amazon 上创建实例

你需要在 Amazon AWS 上创建一个 Ubuntu 14.04 LTS 实例(LTS 是长期稳定版本)。

A0.Micro 实例即可。

你需要启用 SSTP、L2TP 端口和 SoftEther 端口。

2. 在 Ubuntu 上设置 VPN 服务器

要在 Linux 上运行 SoftEther,你需要确保这些库已准备就绪。

如果是在 Ubuntu 14.04 LTS 上运行,你只需要安装 "make"。

gcc software
binutils software
tar, gzip or other software for extracting package files
chkconfig system utility
cat, cp or other basic file operation utility
EUC-JP, UTF-8 or other code page table for use in a Japanese language environment
libc (glibc) library
zlib library
openssl library
readline library
ncurses library
pthread library

3. 下载并安装 SoftEther VPN 服务器

a. 下载 SoftEther

选择你想要的版本,然后按 Enter 下载 gz 文件。

b. 安装 SoftEther

>tar -xzvf softether-vpnserver-v4.14-9529-beta-2015.02.02-linux-x64-64bit.tar.gz

解压后,当前文件夹中会创建一个名为 "vpnserver" 的目录。

>cd vpnserver
>sudo bash
>./.install.sh

你可能会收到一些缺少库的错误。你需要确保拥有以下库:

make、gccbinutils (gcc)、libc (glibc)、zlib、openssl、readline 和 ncurses

>apt-get install build-essential
>./.install.sh

c. SoftEther 许可协议

所有问题都按 1 即可。

d. 将 vpnserver 设置为服务并运行它

>cd ..
>mv vpnserver/ /usr/local
>cd /usr/local/vpnserver

>vi /etc/init.d/vpnserver
 
#!/bin/sh
 # chkconfig: 2345 99 01
 # description: SoftEther VPN Server
 DAEMON=/usr/local/vpnserver/vpnserver
 LOCK=/var/lock/subsys/vpnserver
 test -x $DAEMON || exit 0
 case "$1" in
 start)
 $DAEMON start
 touch $LOCK
 ;;
 stop)
 $DAEMON stop
rm $LOCK
 ;;
 restart)
 $DAEMON stop
 sleep 3
 $DAEMON start
 ;;
 *)
 echo "Usage: $0 {start|stop|restart}"
 exit 1
esac
 exit 0

>mkdir /var/lock/subsys
>chmod 755 /etc/init.d/vpnserver
>/etc/init.d/vpnserver start

>update-rc.d vpnserver defaults
> 
>shutdown -r now

4. 在 Windows 上远程配置 SoftEther VPN 服务器

一旦启动了 vpnserver,你就必须立即运行 SoftEther VPN 服务器管理器来设置服务器,因为 vpnserver 的管理员密码仍然是默认密码。

http://www.softether-download.com/en.aspx?product=softether 下载适用于 Windows 的 SoftEther VPN 服务器管理器。

运行 "vpnsmgr.exe",点击 "New Setting",在弹出窗口中填写主机名,然后点击 "OK"。

然后会弹出另一个窗口更改管理员密码。

然后在接下来的弹出窗口中选择 "Other Advance Configuration of VPN"。

然后在 L2TP 设置窗口中勾选以下 1 或 2 个 L2TP 设置。

然后你需要创建一些 VPN 用户。

输入用户名和密码。

启用 NAT 和虚拟 DHCP。

点击 "Enable SecureNAT",然后点击 "SecureNAT Configuration"。

5. 在 Windows 上设置 L2TP VPN 客户端

在 Windows 7/8 上设置 L2TP 客户端很容易。

你还需要点击 "Advanced settings" 来设置预共享密钥。

6. 检查 VPN 连接状态

© . All rights reserved.