- Saved searches
- Use saved searches to filter your results more quickly
- alfredopalhares/openvpn-update-resolv-conf
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
- как создать /etc/openvpn/update-resolv-conf или как подружить openvpn и openresolv?
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Script that updates DNS settings are pushed by the OpenVPN server
alfredopalhares/openvpn-update-resolv-conf
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Add another approach using systemd-resolved
Git stats
Files
Failed to load latest commit information.
README.md
OpenVPN Update resolvconf
This is a script to update your /etc/resolv.conf with DNS settings that come from the received push dhcp-options. Since network management is out of OpenVPN client scope, this script adds and removes the provided from those settings.
However if you have systemd 229 or newer the better option is to use script from https://github.com/jonathanio/update-systemd-resolved which uses DBus calls instead of creating temporary *.network files.
Place the script in /etc/openvpn/update-resolv-conf.sh or anywhere the OpenVPN client can acess.
Add the following lines to your client configuration:
# This updates the resolvconf with dns settings setenv PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin script-security 2 up /etc/openvpn/update-resolv-conf.sh down /etc/openvpn/update-resolv-conf.sh down-pre
Just start your openvpn client with the command you used to do.
Alternatively, if you don’t want to edit your client configuration, you can add the following options to your openvpn command:
--setenv PATH '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' --script-security 2 --up /etc/openvpn/update-resolv-conf.sh --down /etc/openvpn/update-resolv-conf.sh --down-pre
For bugs and another questions open a ticket in the Isssues Page.
You can find me on irc.freenode.org and in last case mail me through the email that is on my Github Profile
2016 — WGH Added modified script to support systemd-networkd
About
Script that updates DNS settings are pushed by the OpenVPN server
как создать /etc/openvpn/update-resolv-conf или как подружить openvpn и openresolv?
Options error: —up script fails with ‘/etc/openvpn/update-resolv-conf’: No such file or directory (errno=2) Options error: Please correct this error. Use —help for more information.
No such file or directory
да я догадался, что файла update-resolv-conf нет. я конечно могу его создать,но что в него прописать? или как заставить программы его сгенерировать?
Скопируй в update-resolv-conf, сделай исполняемым. В resolv.conf пропиши nameserver 8.8.8.8
#!/usr/bin/env bash # # Parses DHCP options from openvpn to update resolv.conf # To use set as 'up' and 'down' script in your openvpn *.conf: # up /etc/openvpn/update-resolv-conf # down /etc/openvpn/update-resolv-conf # # Used snippets of resolvconf script by Thomas Hood # and Chris Hanson # Licensed under the GNU GPL. See /usr/share/common-licenses/GPL. # 07/2013 colin@daedrum.net Fixed intet name # 05/2006 chlauber@bnc.ch # # Example envs set from openvpn: # foreign_option_1='dhcp-option DNS 193.43.27.132' # foreign_option_2='dhcp-option DNS 193.43.27.133' # foreign_option_3='dhcp-option DOMAIN be.bnc.ch' # foreign_option_4='dhcp-option DOMAIN-SEARCH bnc.local' ## The 'type' builtins will look for file in $PATH variable, so we set the ## PATH below. You might need to directly set the path to 'resolvconf' ## manually if it still doesn't work, i.e. ## RESOLVCONF=/usr/sbin/resolvconf export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin RESOLVCONF=$(type -p resolvconf) case $script_type in up) for optionname in $ ; do option="$" echo $option part1=$(echo "$option" | cut -d " " -f 1) if [ "$part1" == "dhcp-option" ] ; then part2=$(echo "$option" | cut -d " " -f 2) part3=$(echo "$option" | cut -d " " -f 3) if [ "$part2" == "DNS" ] ; then IF_DNS_NAMESERVERS="$IF_DNS_NAMESERVERS $part3" fi if [[ "$part2" == "DOMAIN" || "$part2" == "DOMAIN-SEARCH" ]] ; then IF_DNS_SEARCH="$IF_DNS_SEARCH $part3" fi fi done R="" if [ "$IF_DNS_SEARCH" ]; then R="search " for DS in $IF_DNS_SEARCH ; do R="$ $DS" done R="$ " fi for NS in $IF_DNS_NAMESERVERS ; do R="$nameserver $NS " done #echo -n "$R" | $RESOLVCONF -x -p -a "$" echo -n "$R" | $RESOLVCONF -x -a "$.inet" ;; down) $RESOLVCONF -d "$.inet" ;; esac # Workaround / jm@epiclabs.io # force exit with no errors. Due to an apparent conflict with the Network Manager # $RESOLVCONF sometimes exits with error code 6 even though it has performed the # action correctly and OpenVPN shuts down. exit 0
ОС какая? update-resolv-conf из коробки есть только в Debian и Ubuntu. Если openvpn его требует, значит он прописан в конфиг файле (некоторые VPN поставщики добавляют), убери его оттуда, а DNS настраивай сам в /etc/resolv.conf. Или настраивай VPN через Network Manager. Или как тебе посоветовали, подсунь свой update-resolv-conf по тому пути, который ждет openvpn, правда не факт что заведется.
не дебиан или убунту) спасибо,удалил из своего ovpn файла строчки про ресолв, и заработало