Запуск openvpn как сервис windows
In order to get OpenVPN GUI to auto-start and auto-connect on boot, we need to pick a single configuration for a particular location that we wish to connect on every boot.
For the purpose of this guide, I am going to use PrivateVPN’s OpenVPN-TUN-UDP configuration for India.
Step 1 — Editing your OpenVPN client configuration
Open .ovpn file in Notepad application, look for # Crypto section and make the following changes as seen in the image below:

Save and close the .ovpn file.
Step 2 — Storing your PrivateVPN.com credentials in a file
Open Notepad application and type your PrivateVPN username in first line and password in second, save the file as user.auth.

Step 3 — Import edited .ovpn file and user.auth file to OpenVPN config folder
Navigate to Program files — OpenVPN — config folder of your main Windows installation. Copy your edited .ovpn file and user.auth there. When prompted for Administrative permission, grant it to Continue.

Step 4 — Configuring OpenVPN service to start automatically on boot
Start Run application from Start Menu or by using keyboard shortcut combination Ctrl+R and input services.msc in the text field there and click OK.

Locate OpenVpnService (Not OpenVPN Legacy Service or OpenVPN Interactive Service) and double-click on it.

A dialog box appears, change Startup type to Automatic, and click Apply followed by OK. That is all. OpenVPN configuration file should connect right away and on every boot automatically.

Note: You are not required to use OpenVPN GUI client any more. ‘OpenVpnService’ would automatically connect you to respective PrivateVPN OpenVPN server on boot.
OpenVPN как Windows Service
Настройка автоматического подключения OpenVPN с помощью службы Windows:
1. Устанавливаем дистрибутив OpenVPN, при установке обязательно устанавливаем галочку OpenVPN Service

2. Конфигурационные файлы обязательно должны быть сохранены в папке C:\Program Files (x86)\OpenVPN\config или C:\Program Files\OpenVPN\config (в случае с Windows 64 bit)
3. Переходим в Панель управления — Администрирование — Службы
4. Открываем свойства службы OpenVPNService, ставим тип запуска «Автоматически»

5. Запускаем службу, если всё сделали правильно, то появится новое сетевое соединение с сетевым адаптером TAP-Win32 Adapter V9. Проверить его статус можно в Панели управления – Центр управления сетями и общим доступом
6. Теперь после перезагрузки служба должна запускаться и подключаться самостоятельно
Новости
Дополнительный канал связи
Теперь вы можете связаться с нами через наш личный jabber — support@openvpn.ru.
Наши клиенты могут получить бесплатный акаунт на нашем Jabber сервере.
Новый релиз OpenVPN Portable
Уважаемые клиенты, доступа новая версия решения OpenVPN Portable
Новое решение по блокировке утечек трафика для Windows 7/10.
Доступно новое решение по блокировке утечек трафика для Windows 7/10. Обращайтесь к поддержке!
Самостоятельная смена цепочки дабла
Стала доступна бесплатная смена цепочки дабла из личного кабинета
Новый сервер в Нидерландах!
Уважаемые клиенты, доступен новый сервер в Нидерландах со свежими IP.
Доступен IPv6
теперь вы можете получить адрес IPv6, в дополнение к обычному IPv4. Обращайтесь к поддержке!
How to autostart and autoconnect OpenVPN in Windows 10?
Windows 10 startup seems to be strange, or at least new. Many programs don’t autostart the way they did in previous versions, and a lot of people are asking how to get things to autostart. I know, because I’m constantly looking to autostart my programs I’m used to.
How can I get OpenVPN to start on boot, prevent Internet access until it’s connected, and automatically log in to an OVPN profile?
I already have the credentials saved in a text file, so OpenVPN just needs to load the file, process it, and connect.
I used to have this working on Windows 7, but it seems I’ve forgotten how to do it,
![]()
3 Answers 3
The best way is to use services:
- Install the OpenVPN service when you install the client;
- Place your OpenVPN profiles (with the extension .ovpn, not .conf as is common on Linux) in the config subdirectory of the OpenVPN installation directory, probably C:\Program Files\OpenVPN\config .
- Open the Services console ( services.msc );
- Find OpenVPNService, right click on it, Properties, and change startup type from “Manual” to “Automatic”.
- Start the service, and OpenVPN will find and connect to the profiles in any .ovpn files. Keep in mind in most situations you need one TUN/TAP interface per connection file. In windows, I strongly advise to permanently associate an interface with their connection using the configuration files: dev-node TAP_Serv forces OpenVPN to bind the connection to the network interface named "Tap_Serv". Added after reading some comments: You need one interface per connection. In Linux this is trivial, but in windows it may be problematic. HAving two configurations that you can SEPARATEDLY test succesfully, doesn’t mean they’ll run together, as they may be competing for the same interface. OpenVPN is a ported program, and windows driver subsystem has allways been a pain in the a**.
You may want to investigate is there’s a way to elaborate a whitelist to force the service to connect only to specific files, and not all. I’ve had some issues in the past with people who needed to have a VPN server as a service plus several vpn client files in the same machine that only connect every now and then. In those situations, if I wanted OpenVPN GUI to show them a beautifull list of available connections, it meant that the service saw those files and was trying to connect to them automatically. In those cases, I decided not to use services at all:
If using a service is not an option, you can pass extra command line arguments to the OpenVPN GUI invocation to make it automatically connect on startup (as well as showing the tray icon as usual):
To get that to run when you log in, place such a shortcut in the usual startup folder. (For all users, %ProgramData%\Microsoft\Windows\Start Menu\Programs\Startup ; or for the current user only, %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup .)
I don’t know how to avoid the user to connect to the Internet before the VPN is set. The only way I can figure out if through Windows Firewall, and I’m not an expert on that subject. If you want to avoid a poweruser to be able to get to the Internet you need a firewall in your gateway to avoid so, or strong group policies to avoid privilege scalation.
For a normal user, you can configure the Windows client machine without a default gateway. Set a persistent static route to the VPN server on Windows clients using the following command (-P makes it persistent):
Roues in Windows are stored under the following registry key:
At this point a disconnected client only has access to the VPN server. Then you can add the following lines in the VPN server configuration file to add routes on clients when they connect:
To configure the VPN server as the default gateway:
To add an specific route through the VPN Server:
Sometimes route pushing doesnt work on Windows. When this happens to me, I completly uninstall OpenVPN and it’s interfaces from Windows, restart system and install the latest version of the software. Then, before stablishing the first connection, I restart Windows. This has allways solved the issues, however, Windows 10 Anniversary update (1607) is buggy with OpenVPN. There’s a link to a deeper discussion in OpenVPN forums:
Keep that in mind when you setup your Windows 10 OpenVPN clients.
If you’re a consultant looking SU to give advice to a client, please consider using some specific NATIVE windows solutions, if your client’s budget allows for it. I won’t name any to avoid being flagged, but most knowns networking hardware companies offer solutions compatible with their devices that provide native drivers for any edge OS you mayb think of. Disclaimer: I don’t work for any of those companies. For my own dialy life I use OpenVPN, but to remotely connect to my company they’ve a commercial solution bundled on the computers: I never had a single connection issue, while OpenVPN is usually more delicated. Don’t take me wrong, I’ve delivered OpenVPN to production environments for clients with total success, but you need to be extra cautionous (and put watchdog and recoverfy measures in place, or just train the user to "click reconnect if something doesn’t work properly")
Автозапуск OpenVPN в Windows при старте системы
Это инструкция о том как настроить автозапуск OpenVPN и подключиться к выбранному серверу автоматически при старте Windows. Для этого не нужно настраивать планировщик задач или создавать командные файлы как во многих других инструкциях доступных в сети.
Всё, что необходимо — это поместить ярлык OpenVPN GUI в папку «Автозагрузка». Тем не менее, чтобы данный способ заработал необходимо выполнить несколько условий.
Установите самую последнею версию OpenVPN и проверьте настройки привилегий
На момент написания данного текста последняя версия OpenVPN была 2.4.4, она содержит ряд важных исправлений и улучшений, самое главное из них — OpenVPN теперь можно запускать без прав администратора.
Важно! С версией ниже чем 2.4.4 описанный в инструкции способ работать не будет
Важно! Если ранее у вас была установлена версия OpenVPN ниже чем 2.4.4 убедитесь в том, что для исполняемого файла openvpn-gui.exe не установлен уровень привилегий «Выполнять эту программу от имени администратора».
Для этого откройте свойства файла openvpn-gui.exe из папки «C:\Program Files\OpenVPN\bin» или «C:\Program Files (x86)\OpenVPN\bin», перейдите на вкладку «Совместимость» и убедитесь в том, что настройка «Выполнять эту программу от имени администратора» отключена.

Автозапуск (автозагрузка) OpenVPN настройка
Поместите ярлык openvpn-gui.exe в папку «Автозагрузка», для этого:
Шаг 1. Чтобы открыть папку «Автозагрузка» нажмите сочетание клавиш Win+R и в открывшемся окне наберите shell:startup, после чего нажмите «Ок»

Шаг 2. Далее в открывшейся папке создайте ярлык и укажите следующее расположение объекта:
«C:\Program Files\OpenVPN\bin\openvpn-gui.exe» если у вас 64х разрядная Windows
«C:\Program Files (x86)\OpenVPN\bin\openvpn-gui.exe» если у вас 32х разрядная Windows
Примечание! Чтобы определить, установлена на компьютере 32-разрядная или 64-разрядная версия Windows воспользуйтесь этой ссылкой.
Шаг 3. После чего не торопитесь закрывать окно, а дополните указанную ранее строку следующими опциями:
—connect <имя_файла_конфигурации_openvpn>
—silent_connection 1
Опция connect позволяет выбрать файл конфигурации, а соответственно и сервер к которому подключаться. Опция silent_connection позволяет не показывать диалог состояния при подключении.
Ваши файлы конфигурации находятся в папке «C:\Program Files\OpenVPN\config» или «C:\Program Files (x86)\OpenVPN\config»
Таким образом, если при старте системы Вы желаете подключать OpenVPN с конфигурацией nl01.secretvpn.net.ovpn, в расположение объекта при создании ярлыка вам необходимо прописать следующую строку:
«C:\Program Files\OpenVPN\bin\openvpn-gui.exe» —connect nl01.secretvpn.net.ovpn —silent_connection 1 для 64х разрядных систем
«C:\Program Files\OpenVPN(x86)\bin\openvpn-gui.exe» –-connect nl01.secretvpn.net.ovpn —silent_connection 1 для 32х разрядных систем

Шаг 4. Завершите создание ярлыка, автозапуск OpenVPN настроен и теперь ваш VPN будет запускаться и подключаться к выбранному серверу автоматически при входе в систему.
Полезное! Если Вы хотите избавиться от назойливого диалога ввода пароля каждый раз при подключении OpenVPN сохраните пароль в отдельный файл и укажите его в конфигурации OpenVPN так, как это сделано в инструкции «Как сохранить имя пользователя и пароль в OpenVPN клиенте» для версий более ранних чем 2.4.0 и тогда ваш OpenVPN будет запускаться без всяких дополнительных окон.