Openvpn安装和配置介绍资料.doc
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《Openvpn安装和配置介绍资料.doc》由会员分享,可在线阅读,更多相关《Openvpn安装和配置介绍资料.doc(35页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、*OpenVPN实现网络互连一、试验网络架构21.服务器信息22.操作系统对tun的支持性23.所需软件及作用3二、LZO软件安装3三、Openvpn安装5四、Openvpn server文件生成61.编辑Vars文件62.创建CA文件7五、创建Openvpn Server所需文件9六、创建client端所需文件10七、设置openvpn server的配置文件12八、Openvpn Server的配置文件server001.conf13九、客户端主机的配置文件client001.ovpn22十、Openvpn server主机上启用openvpn服务25十一、Openvpn Client主机
2、连接Openvpn Server26十二、Client内网主机访问server内网主机261.server主机配置文件下添加ccd文件夹262.Server主机上开启路由转发和NAT263.client主机上开启路由和远程访问264.Client内网主机静态路由添加315.Client访问server多内网段32十三、测试结果32十四、总结34十五、参考文档35OpenVPN实现网络互连一、 试验网络架构1. 服务器信息服务器名称OS版本内网IP地址内网网关外网IP地址Openvpn ServerRedHat AS410.0.17.6010.0.17.1NATOpenvpn ClientWin
3、dows2003192.168.0.82192.168.0.12. 操作系统对tun的支持性 试验中安装的Red Hat AS4内核默认已经支持tun,并且已经安装tun模块。对于一些没安装此模块的,需要重新编译内核支持。内核加载tun模块只是让内核支持隧道,并不是就会出现隧道接口。在没安装此模块的系统上加载tun模块:Linux 2.4 or higher (with integrated TUN/TAP driver):(1) make device node: mknod /dev/net/tun c 10 200(2a) add to /etc/modules.conf: alias
4、char-major-10-200 tun(2b) load driver: modprobe tun(3) enable routing: echo 1 ; /proc/sys/net/ipv4/ip_forward3. 所需软件及作用OpenVPN依赖OpenSSL库,加密用;LZO库,数据压缩用。在我安装的Red Hat AS4系统默认安装了OpenSSL库,没有的可以到www.openssl.org下载。LZO软件是必须的,否则无法安装Openvpn软件,可以到下载。LZO包含几个版本,在测试中我选择是的lzo-2.0.2。以上是辅助软件,Openvpn软件的下载地址为,我选择的是比较
5、稳定的openvpn-2.0.9版。之前在windows下包含2.0.3和2.0.9等多个版本,但是2.0.9版本在windows下安装的时候由于程序问题在生成CA文件的时候会出错,如果是在windows下安装建议选择2.0.3版本。yum install openssl openssl-devel二、 LZO软件安装如果之前有点点Linux系统的知识的话,此步就可跳过。首先解压下载的lzo-2.0.2.tar.gz文件,命令为tar zxvf lzo-2.0.2.tar.gz(至于不知道在哪里敲此命令的,建议看看Linux的基本操作,在桌面上点右键选择“打开终端”,在跳出的框里输入)如下图所
6、示解压完毕后在当前目录下会有一个名为lzo-2.0.2的文件夹,通过cd命令切换到lzo-2.0.2目录下(切换完毕后可以通过pwd命令察看)。具体如下图所示下一步输入./configure命令检查文件(注意前面有个点,而且是要切换到此目录下执行的)。注释:一般的configure都是一个script,执行后可以传入必要参数告知配置项目,最后产生Makefile档案后才可以给make程式读入使用,尽而呼叫相关编译程式。然后输入make命令编译,如下图所示最后通过输入命令make intall来安装lzo至此lzo安装完毕三、 Openvpn安装Openvpn的安装与lzo的安装命令一致,都是.
7、/configure然后make最后make install安装,在此不赘述。在工作中有时候可能一台电脑做为两个或多个client端,因此需要在同一电脑上安装两个或多个openvpn软件。为了保证在运行的时候不冲突,在./configure的时候需要加入prefix参数来指定makefile文件的位置。详情如下:-prefix是最常用的选项,制作出的 Makefile会查看随此选项传递的参数,当一个包在安装时可以彻底的重新安置他的结构独立部分。 举一个例子,当安装一个包,例如说Emacs,下面的命令将会使Emacs Lisp file被安装到/opt/gnu/:$ ./configure -p
8、refix=/opt/gnu./configure -with-lzo-headers=/usr/local/include -with-lzo-lib=/usr/local/lib -with-ssl-headers=/usr/local/include/openssl -with-ssl-lib=/usr/local/lib四、 Openvpn server文件生成首先切换到openvpn安装目录下,例如我是把openvpn安装在/home/coldface/openvpn-2.0.9下,我通过在终端中输入命令cd /home/coldface/openvpn-2.0.9(coldface
9、此文件夹是自己建的,命令为mkdir /home/coldface,在安装过程中自己选择合适的目录)。然后输入cd easy-rsa/命令,切换到easy-ras目录下进行配置。下面的操作都是依据在此目录下进行的。1. 编辑Vars文件Vars文件的作用是是创建环境变量初始化程序,通过输入vi ./vars来进行编辑。(针对不熟悉vi操作的,自己找到此目录下的文件,双击用文本编辑器编辑),然后按下键盘的i键进行修改。主要是修改一些openvpn所在地等信息,如KEY_COUNTRY,KEY_PROVINCE,KEY_CITY,KEY_ORG等。修改完毕后按下ESC键,然后输入:wq保存退出(L
10、inux对命令区分大小写,留意命令的字母)。如下图所示修改完毕后,输入命令. ./vars运行此脚本(注意两个点中间有个空格)然后输入./clean-all继续运行,此命令主要是在easy-ras下生成一个keys文件夹用于存放后续生成的key,crt等文件。2. 创建CA文件输入./build-ca生成CA文件,CA证书用于验证客户端的证书是否合法,因此客户端和服务器端都需要此证书。详细结果为: You are about to be asked to enter information that will be incorporatedinto your certificate reque
11、st.What you are about to enter is what is called a Distinguished Name or a DN.There are quite a few fields but you can leave some blankFor some fields there will be a default value,If you enter ., the field will be left blank.-Country Name (2 letter code) CN:State or Province Name (full name) JS:Loc
12、ality Name (eg, city) Suzhou:Organization Name (eg, company) OpenVPN:Organizational Unit Name (eg, section) :OpenVPNtestCommon Name (eg, your name or your servers hostname) :RootCA(此处名字任意)3.创建加密算法所需文件dh1024.pem输入命令./build-dh五、 创建Openvpn Server所需文件输入命令./build-key-server server001(注意此处后面添加了server001,名
13、字可以任意,但是一定要与下面程序中的Common Name一致)详细信息为:.+.+writing new private key to keysserver01.key-You are about to be asked to enter information that will be incorporatedinto your certificate request.What you are about to enter is what is called a Distinguished Name or a DN.There are quite a few fields but you
14、can leave some blankFor some fields there will be a default value,If you enter ., the field will be left blank. Country Name (2 letter code) CN:State or Province Name (full name) JS:Locality Name (eg, city) Suzhou:Organization Name (eg, company) OpenVPN:Organizational Unit Name (eg, section) :penvpn
15、testCommon Name (eg, your name or your servers hostname) :Server001(此处的名字一定要与./build-key-server后输入的名字一致)Please enter the following extra attributesto be sent with your certificate requestA challenge password :An optional company name :Using configuration from fCheck that the request matches the sign
16、atureSignature okCertificate is to be certified until Feb 9 10:01:34 2016 GMT (3650 days)Sign the certificate? y/n:y (选择Y)1 out of 1 certificate requests certified, commit? y/ny(选择Y)Write out database with 1 new entriesData Base Updated六、 创建client端所需文件输入命令./build-key client001(注意此处后面添加了client001,名字可
17、以任意,但是一定要与下面程序中的Common Name一致)详细信息为:Generating a 1024 bit RSA private key.+.+writing new private key to keyselm.key-You are about to be asked to enter information that will be incorporatedinto your certificate request.What you are about to enter is what is called a Distinguished Name or a DN.There a
18、re quite a few fields but you can leave some blankFor some fields there will be a default value,If you enter ., the field will be left blank.-Country Name (2 letter code) CN:State or Province Name (full name) JS:Locality Name (eg, city) Suzhou:Organization Name (eg, company) OpenVPN:Organizational U
19、nit Name (eg, section) :openvpntestCommon Name (eg, your name or your servers hostname) :client001(此处的名字一定要与./build-key后输入的名字一致)Please enter the following extra attributesto be sent with your certificate requestA challenge password :An optional company name :Check that the request matches the signat
20、ureSignature okCertificate is to be certified until Feb 9 10:05:53 2016 GMT (3650 days)Sign the certificate? y/n:y (选择Y)1 out of 1 certificate requests certified, commit? y/ny(选择Y)Write out database with 1 new entriesData Base Updated注意Common name,如果有多个客户端连接的时候,Common name不能重复,另外要注意名字不要弄错,在后面配置服务器端内
21、网访问客户端内网的时候需要此名字。此时文件都是保存在keys目录下(/home/coldface/openvpn-2.0.9/easy-ras/keys)在试验中我在/etc下建立一新目录openvpn来存放配置文件(命令为mkdir /etc/openvpn),在上述步骤完毕后,把ca.key,ca.crt,dh-1024.pem,server001.crt,server001.key复制到openvpn目录下(命令为cp ca.key ca.crt dh-1024.pem server001.crt server001.key /etc/openvpn)。七、 设置openvpn serv
22、er的配置文件首先通过cd .(cd后有个空格然后是两个点),退回到/home/coldface/openvpn-2.0.9目录下,输入cd sample-config-files/切换到sample-config-files文件夹下,把此目录下的server.conf修改名字为server001.conf,然后把server001.conf文件复制到/etc/openvpn目录下(命令为cp server001.conf /etc/openvpn)。在后面会介绍如何配置server001.conf此配置文件。Openvpn client主机上安装软件一直点下一步即可。安装完毕后,只需把Ope
23、nvpn server主机上的ca.crt client001.key client001.crt复制到openvpn的安装目录下的config目录下。例如我安装在默认的C:Program FilesOpenVPN,那么ca.crt client001.key client001.crt client001.ovpn都放置在C:Program FilesOpenVPN下的config目录下面。八、 Openvpn Server的配置文件server001.conf首先回顾下文件的存放位置,安装程序目录是/home/coldface/openvpn-2.0.9,配置文件的存放目录是/etc/op
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- openvpn 安装 以及 配置 介绍 资料
![提示](https://www.taowenge.com/images/bang_tan.gif)
限制150内