欢迎来到天天文库
浏览记录
ID:34724163
大小:60.12 KB
页数:21页
时间:2019-03-10
《linux下openvpn服务安装记》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、Linux下OpenVPN服务安装记操作系统是CentOS,运行在XEN架构的VPS上面。环境配置首先,检测VPS是否支持TUN(via):cat/dev/net/tun返回“cat:/dev/net/tun:Filedescriptorinbadstate”说明支持TUN。检测iptables_nat模块支持:iptables-tnat-APOSTROUTING-s10.8.0.0/24-oeth0-jMASQUERADE如果返回信息为:iptables:Unknownerror4294967
2、295说明支持模块。安装LZO库:wgethttp://www.oberhumer.com/opensource/lzo/download/lzo-2.05.tar.gztarzxvflzo-2.05.tar.gzcdlzo-2.05./configuremakemakeinstall安装OpenSSL开发库:yuminstall-yopenssl-devel服务端安装配置然后,在服务器端下载OpenVPN源代码(下载页面),目前最新版本为2.2.0:wgethttp://swupdate.op
3、envpn.net/community/releases/openvpn-2.2.0.tar.gz解压编译安装:tarzxfopenvpn-2.2.0.tar.gzcdopenvpn-2.2.0./configure–prefix=/usr/local/openvpnmakemakeinstall复制服务端样例配置文件:cpsample-config-files/server.conf/usr/local/openvpn/etc/server.conf编辑配置文件为,比如我的以下内容,采用UDP
4、协议监听53端口:##################################################SampleOpenVPN2.0configfilefor##multi-clientserver.####Thisfileisfortheserverside##ofamany-clients<->one-server##OpenVPNconfiguration.####OpenVPNalsosupports##single-machine<->single-machine##
5、configurations(SeetheExamplespage##onthewebsiteformoreinfo).####ThisconfigshouldworkonWindows##orLinux/BSDsystems.Rememberon##Windowstoquotepathnamesanduse##doublebackslashes,e.g.:##"C:\ProgramFiles\OpenVPN\config\foo.key"####Commentsareprecededw
6、ith‘#’or‘;’###################################################WhichlocalIPaddressshouldOpenVPN#listenon?(optional);locala.b.c.d#WhichTCP/UDPportshouldOpenVPNlistenon?#IfyouwanttorunmultipleOpenVPNinstances#onthesamemachine,useadifferentport#numberfor
7、eachone.Youwillneedto#openupthisportonyourfirewall.port53#TCPorUDPserver?;prototcpprotoudp#"devtun"willcreatearoutedIPtunnel,#"devtap"willcreateanethernettunnel.#Use"devtap0"ifyouareethernetbridging#andhaveprecreatedatap0virtualinterface#andbridgedit
8、withyourethernetinterface.#Ifyouwanttocontrolaccesspolicies#overtheVPN,youmustcreatefirewall#rulesforthetheTUN/TAPinterface.#Onnon-Windowssystems,youcangive#anexplicitunitnumber,suchastun0.#OnWindows,use"dev-node"forthis.#Onmostsystems,theVPNwillnotf
此文档下载收益归作者所有