Vyatta 路由器的 OpenVPN 使用介绍

Vyatta 的 VPN 功能十分强大,同时集成了 IPSec, OpenVPN, PPTP 等多种VPN 技术。其官方产品 Vyatta 3500, 宣称能够以高达900 mbps的速度,同时处理多达8000条IPSec VPN隧道,费用只需要约6000美元,而同类的思科ASR 1006设备价格超过10万美元。 但是对于镇里来讲,大多数的中小企业都是通过 PPPoE 拨号上网,没有固定 IP,使用 IPSec VPN 不是那么方便,这里 OpenVPN 就大显身手了。其实,即使有固定 IP, 清风也不认为 IPSec VPN 会更优秀呢。在最新的 Vyatta Core 6.3 版本中,对 OpenVPN 也作了几个重大的功能增强。


在 Vyatta 上安装 OpenVPN 灰常简单,只需要简单的几个步骤就可以完成。假设我们已经用EasyRSA 准备好了 OpenVPN 服务器的 ca, server key, client key 等文件,不会的同学请参考清风的这篇文章。将这些文件上传到 Vyatta 目录 /config/auth 上。请注意,在之前版本下这些文件可以上传至任意位置,但6.3版本不行了。运行下面这个脚本,配置 OpenVPN 服务器:

#file: /home/vyatta/scripts/vpn-server-setup.sh
#Author: Bill Deng
Date: 2011-11-02

SRVVPNIF=’vtun0′
set interfaces openvpn $SRVVPNIF
edit interfaces openvpn $SRVVPNIF
set mode server
set openvpn-option “–push route 192.168.10.0 255.255.255.0 –comp-lzo”
set protocol udp
top
set interfaces openvpn $SRVVPNIF server
edit interfaces openvpn $SRVVPNIF server
set subnet 10.1.1.0/24
set topology subnet
set client test1 ip 10.1.1.100
set client test1 subnet 192.168.0.0/24
top
set interfaces openvpn $SRVVPNIF tls
edit interfaces openvpn $SRVVPNIF tls
set ca-cert-file /config/auth/srv-keys/ca.crt
set cert-file /config/auth/srv-keys/serv.crt
set crl-file /config/auth/srv-keys/crl.pem
set dh-file /config/auth/srv-keys/dh1024.pem
set key-file /config/auth/srv-keys/serv.key
top
commit
save

下面再配置 OpenVPN 客户端, 把 OpenVPN Client 的相关文件(ca, client key, client crt)上传到客户端机器上,运行下面这个脚本,相对简单很多,是吧?
CLTVPNIF=’vtun0′
set interfaces openvpn $CLTVPNIF
set interfaces openvpn $CLTVPNIF remote-host your.host.name
set interfaces openvpn $CLTVPNIF mode client
set interfaces openvpn $CLTVPNIF protocol udp
set interfaces openvpn $CLTVPNIF openvpn-option “–comp-lzo”
set interfaces openvpn $CLTVPNIF tls ca-cert-file /config/auth/keys/ca.crt
set interfaces openvpn $CLTVPNIF tls cert-file  /config/auth/keys/client1.crt
set interfaces openvpn $CLTVPNIF tls key-file  /config/auth/keys/client1.key
commit
save

请注意上面这个配置是 Client – Server 方式, Server 与 Client 网关下的网络必须为不同网段,下面各主机才可以正常通信。 在这种方式下, Client 与 Client 之间可以互相通信,如果不想 Client 之间互相通信,可以选用 Point – Point 方式。同时还有一种 site – site 方式,大家都可以偿试一下。

关于 清风

关注IT资讯,虚拟化技术,企业VPN, VoIP, CRM应用等。
本文章发表于 (This entry was posted in) linux 技术, Vyatta 专题, 网络管理 标签 (and tagged) , , . 收藏 (Bookmark the) 永久链接(permalink).

发表评论 Leave a Reply

邮箱不会出现在评论中(Your email address will not be published.) *号为必填项 Required fields are marked *

*

你可以使用一些简单的 HTML 命令。You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

请回答(What is) 14 + 4 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)