自创open vp n windows步骤
Easy Windows Guide¶
This page contains a no-frills guide to getting OpenVPN up and running on a Windows server and client(s). For a more detailed understanding of setting up OpenVPN and its advanced features, see the HOWTO page.
Table of contents¶
6.2 Port Forwarding
6.5 Security Tips
Downloading and Installing OpenVPN¶
- Download the installer from here and run it on the server computer.
- Install OpenVPN on each client. (This step can be skipped for now and done at any convenient time)
Certificates and Keys¶
Preparatory Steps¶
- Navigate to the C:\Program Files\OpenVPN\easy-rsa folder in the command prompt:
- Press Windows Key + R
- Type "cmd.exe" and press Enter.
cmd.exe
- Navigate to the correct folder:
cd "C:\Program Files\OpenVPN\easy-rsa"
- Initialize the OpenVPN configuration:
init-config
- NOTE: Only run init-config once, during installation.
- Open the vars.bat file in a text editor:
notepad vars.bat
- Edit the following lines in vars.bat, replacing "US", "CA," etc. with your company's information:
set KEY_COUNTRY=US
set KEY_PROVINCE=CA
set KEY_CITY=SanFrancisco
set KEY_ORG=OpenVPN
set KEY_EMAIL=mail@host.domain
- Save the file and exit notepad.
- Run the following commands:
vars
clean-all
Building Certificates and Keys¶
- The certificate authority (CA) certificate and key:
build-ca
- When prompted, enter your country, etc. These will have default values, which appear in brackets. For your "Common Name," a good choice is to pick a name to identify your company's Certificate Authority. For example, "OpenVPN-CA":
Country Name (2 letter code) [US]:
State or Province Name (full name) [CA]:
Locality Name (eg, city) [SanFrancisco]:
Organization Name (eg, company) [OpenVPN]:
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:OpenVPN-CA
Email Address [mail@host.domain]:
- When prompted, enter your country, etc. These will have default values, which appear in brackets. For your "Common Name," a good choice is to pick a name to identify your company's Certificate Authority. For example, "OpenVPN-CA":
- The server certificate and key:
build-key-server server
- When prompted, enter the "Common Name" as "server"
- When prompted to sign the certificate, enter "y"
- When prompted to commit, enter "y"
- Client certificates and keys:
- For each client, choose a name to identify that computer, such as "mike-laptop" in this example.
build-key mike-laptop
- When prompted, enter the "Common Name" as the name you have chosen (e.g. "mike-laptop")
- Repeat this step for each client computer that will connect to the VPN.
- Generate Diffie Hellman parameters (This is necessary to set up the encryption)
build-dh
Configuration Files¶
- Find the sample configuration files:
Start Menu -> All Programs -> OpenVPN -> OpenVPN Sample Configuration Files
Server Config File¶
- Open server.ovpn
- Find the following lines:
ca ca.crt
cert server.crt
key server.keydh dh1024.pem
- Edit them as follows:
ca "C:\\Program Files\\OpenVPN\\config\\ca.crt"
cert "C:\\Program Files\\OpenVPN\\config\\server.crt"
key "C:\\Program Files\\OpenVPN\\config\\server.key"dh "C:\\Program Files\\OpenVPN\\config\\dh1024.pem"
- Save the file as C:\Program Files\OpenVPN\easy-rsa\server.ovpn
Client Config Files¶
This is similar to the server configuration
- Open client.ovpn
- Find the following lines:
ca ca.crt
cert client.crt
key client.key
- Edit them as follows:
ca "C:\\Program Files\\OpenVPN\\config\\ca.crt"
cert "C:\\Program Files\\OpenVPN\\config\\mike-laptop.crt"
key "C:\\Program Files\\OpenVPN\\config\\mike-laptop.key"- Notice that the name of the client certificate and key files depends upon the Common Name of each client.
- Edit the following line, replacing "my-server-1" with your server's public Internet IP Address or Domain Name. If you need help, see Static Internet IP below.
remote my-server-1 1194
- Save the file as C:\Program Files\OpenVPN\easy-rsa\mike-laptop.ovpn (in this example. Each client will need a different, but similar, config file depending upon that client's Common Name.)
Copying the Server and Client Files to Their Appropriate Directories¶
- Copy these files from C:\Program Files\OpenVPN\easy-rsa\ to C:\Program Files\OpenVPN\config\ on the server:
ca.crt
dh1024.pem
server.crt
server.key
server.ovpn
- Copy these files from C:\Program Files\OpenVPN\easy-rsa\ on the server to C:\Program Files\OpenVPN\config\ on each client (mike-laptop, in this example):
ca.crt
mike-laptop.crt
mike-laptop.key
mike-laptop.ovpn
Starting OpenVPN¶
- On both client and server, run OpenVPN from:
Start Menu -> All Programs -> OpenVPN -> OpenVPN GUI
- Double click the icon which shows up in the system tray to initiate the connection. The resulting dialog should close upon a successful start.
Further Considerations / Troubleshooting¶
Firewall Configuration¶
If you have connection problems, make sure to set a rule on your server's firewall allowing incoming traffic on UDP port 1194.
Port Forwarding¶
If your server is behind a router, you will need to forward the port chosen for OpenVPN (in this example UDP 1194) to the server. Consult your router's documentation for details on this.
To set up port forwarding, you will likely need to set up the server with a static local IP address instead of the default dynamic (changing) IP. Instructions for Windows XP may be found here. Make sure to choose a static IP address that is not in the range your router might assign as a dynamic IP, but is within the router's subnet (usually 192.168.0.xxx , 10.0.0.xxx , or similar).
Static Internet IP¶
Your server will need to have a static internet IP or Domain Name to be accessible over the long term. One solution is to sign up for an account with DynDNS and install the DynDNS Updater on your server. When signing up you will determine the static Domain Name of your server. (For example, "myserver.dyndns.org") You will use this Domain Name in the client configuration files as part of the "remote" directive.
Running OpenVPN as a Service¶
Running OpenVPN as a service will allow:
- OpenVPN to be run from a non-administrator account.
- OpenVPN to be started automatically on system startup. This is often preferred on the server machine, as well as any machines which will be constantly connected to the server.
- Run the Windows Service administrative tool:
- Press Windows Key + R
- Type "services.msc" and press Enter.
services.msc
- Find the OpenVPN service, and set its Startup Type to "automatic."
- Optionally, start the service now.
Security Tips¶
- Transmit all needed files to the client computers using a secure means such as a USB drive (email is not always a secure means).
- Choose a port other than UDP 1194, and replace the port number wherever this guide mentions UDP port 1194.
Cloning OpenVPN Servers¶
If including OpenVPN in a cloned server build you will find that all servers will have the same MAC address for the TAP device. This will cause packet loss across the network. Standard methods of changing the IP address from scripts do not work on the TAP device, to resolve this delete and recreate the TAP device using the scripts included with OpenVPN:
C:\Program Files\OpenVPN\bin\deltapall
C:\Program Files\OpenVPN\bin\addtap
You will then have to rename the connection to match the entry in the config file.
Download in other formats:
自创open vp n windows步骤的更多相关文章
- 用 Windows Server 2019 搭建求生之路服务器
准备工作 要搭建一台 Windows Server 的求生之路服务器需要做以下几点前置工作: 购买一台云服务器,如腾讯云: 下载 SteamCMD: 安装 SourceMod.MateMod.L4dT ...
- XMind8激活为Pro教程 - Windows&Mac
本教程用于激活XMind(思维导图制作软件),仅限于个人学习使用. 目前本人激活的版本是xmind8-up6版本,其他更高版本不保证能适用. Windows步骤: 1.英文官网下载客户端并安装(不能用 ...
- Selenium+TestNG+Maven+Jenkins+SVN(转载)
转载自:https://blog.csdn.net/u014202301/article/details/72354069 一. 创建Maven项目,下载Selenium和TestNG的依赖(依赖可以 ...
- Git使用手册【转】
转自:https://www.jianshu.com/p/e32a8e7ca93b 目录: Git是什么 基本概念 Git的诞生 Git的安装与配置 创建版本库 Git操作略览 远程仓库:git的杀招 ...
- 用VC资源动态链接库解决国际化问题
http://daixinghe.blog.163.com/blog/static/1843615920097181952979/ 随着计算机应用的普及,应用软件跨国使用越来越频繁,如何实现应用软件的 ...
- Zabbix安装与简单配置
目录 0. 前言 1. 安装 1.1 准备安装环境 1.1.1 下载安装包 1.1.2 修改文件配置 1.2 开始安装 2. 实验环境 2.1 简易拓扑图 2.2 基本配置 3. 配置 0. 前言 不 ...
- (一)Protobuf的Java使用
学习使用Protobuf,创建java文件 windows : 步骤一:两个文件:proto.exe, protobuf-Java-2.4.1.jar 步骤二:建立一个工程CreateProtoBu ...
- linux入门基础_centos(二)--fdisk分区
课时10 使用fdisk进行磁盘管理 fdisk是来自IBM的老牌分区工具,支持绝大多数的操作系统,几乎所有的linux的发行版本都装有fdisk,包括在linux的rescu ...
- C语言基础--结构体对齐,位域,联合体
结构体对齐 1--结构体对齐的原因与意义 许多计算机系统对基本数据类型的可允许地址做出了一些限制,要求某种类型的对象的地址必须是某个值K(通常是2,4,8)的倍数,而这个k则被称为该数据类型的对齐模数 ...
随机推荐
- springboot: mybatis逆向工程
第一步: pom文件配置 黄线的部分是所要配置的 <?xml version="1.0" encoding="UTF-8"?> <projec ...
- JVM的监控命令
JVM监控命令基本就是 jps.jstack.jmap.jhat.jstat 几个命令的使用就可以了 JDK本身提供了很多方便的JVM性能调优监控工具,除了集成式的VisualVM和jConsole外 ...
- 利用 ICEpdf 快速实现 pdf 文件预览功能
之前工作中,需要实现一个在线预览pdf的功能,一开始用的的 jQuery-media 插件来实现的,后来感觉有点慢,就继续寻找更好的替代品,直到遇见了 ICE pdf... ICEpdf (官网:ht ...
- vmware8~12最新版本 克隆Centos6.X 系列虚拟机网卡无法启动问题 (三步即可)
1.因工作或者学习需要,都需要在VM上克隆一台服务器,此时无论是快捷克隆(相当于快照的机体)或者完整克隆,都会碰到IP问题. 如:创建后症状:启动之后使用ifconfig,发现无ip地址,只有回环地址 ...
- Mongodb操作之查询(循序渐进对比SQL语句)(转http://www.tuicool.com/articles/UzQj6rF)
工具推荐:Robomongo,可自行百度寻找下载源,个人比较推荐这个工具,相比较mongoVUE则更加灵活. 集合简单查询方法 mongodb语法:db.collection.find() //co ...
- 十五、curator recipes之DistributedQueue
简介 curator实现了先入先出的分布式消息队列,它采用的是zookeeper的持久化有序节点. 官方文档:http://curator.apache.org/curator-recipes/dis ...
- Druid SqlParser理解及使用入门
以前的项目中很少去思考SQL解析这个事情,即使在saas系统或者分库分表的时候有涉及到也会有专门的处理方案,这些方案也对使用者隐藏了实现细节. 而最近的这个数据项目里面却频繁涉及到了对SQL的处理,原 ...
- 安装vmware player
一.简介 什么是虚拟机? 虚拟机是通过软件来模拟一个完整的计算机系统.简单来说,你可以在当前系统中通过虚拟机软件运行另外一个系统,并且与当前系统隔离. 什么是vmware? vmware(virtua ...
- 16、IO (Properties、序列化流、打印流、CommonsIO)
Properties集合的特点 * A: Properties集合的特点 * a: Properties类介绍 * Properties 类表示了一个持久的属性集.Properties 可保存在流中或 ...
- Java Swing实战(四)按钮组件JButton及其事件监听
接下来为面板添加保存按钮,并为按钮绑定事件监听. /** * @author: lishuai * @date: 2018/11/26 13:51 */ public class WeimingSyn ...