Compare languages | Модуль openvpn: FAQ

Почему не работает автоматическая настройка DNS-сервера при подключении на macOS и Linux с помощью клиента OpenVPN?

Why doesn’t automatic DNS server configuration work when connecting to macOS and Linux using the OpenVPN client?

В связи с архитектурными особенностями операционных систем семейства Linux и macOS автоматическая конфигурация DNS-сервера при подключении с помощью официального клиента OpenVPN невозможна.

Due to the architectural features of the Linux and macOS operating systems, automatic DNS server configuration when using the official OpenVPN client is not possible.

Для настройки DNS-сервера в таких ОС сервисом предусмотрена возможность использования сторонних скриптов, которые запускаются при подключении и отключении клиента.

To configure the DNS server on such operating systems, the service provides the ability to use third-party scripts that run when the client connects or disconnects.

В клиентских конфигурациях, генерируемых модулем, предопределены и закомментированы блоки, отвечающие за эти настройки:

In the client configurations generated by the module, the blocks responsible for these settings are predefined and commented out:

bash

bash

Uncomment the lines below for use with Linux

Uncomment the lines below for use with Linux

script-security 2

script-security 2

If you use resolved

If you use resolved

up /etc/openvpn/update-resolv-conf

up /etc/openvpn/update-resolv-conf

down /etc/openvpn/update-resolv-conf

down /etc/openvpn/update-resolv-conf

If you use systemd-resolved, first install the openvpn-systemd-resolved package

If you use systemd-resolved, first install the openvpn-systemd-resolved package

up /etc/openvpn/update-systemd-resolved

up /etc/openvpn/update-systemd-resolved

down /etc/openvpn/update-systemd-resolved

down /etc/openvpn/update-systemd-resolved

Для активации указанных блоков кода необходимо их раскомментировать (удалить начальный символ #), а также указать корректные пути к скриптам.

To use these code blocks, uncomment them (remove the initial # symbol), and specify the correct paths to the scripts.

Скрипты можно подготовить самостоятельно или воспользоваться готовыми решениями от официального OpenVPN Community (для Linux). Для macOS можно воспользоваться сторонним скриптом.

You can either prepare the scripts yourself or use ready-made scripts from the official OpenVPN Community (for Linux). For macOS, you can use a third-party script.

Скрипты должны обладать правами на исполнение.

Scripts must have execution permissions.