jonathanio / update-systemd-resolved

Helper script for OpenVPN to directly update the DNS settings of a link through systemd-resolved via DBus.
Other
761 stars 94 forks source link

Error running OVPN: Linux ip addr add failed: external program exited with error status: 2 #77

Closed typoworx-de closed 1 year ago

typoworx-de commented 4 years ago

I added this as mentioned in instructions at end of my ovpn file after running make command.

script-security 2
up /etc/openvpn/scripts/update-systemd-resolved
up-restart
down /etc/openvpn/scripts/update-systemd-resolved
down-pre

Trying to connect openvpn I'm getting this error:

Linux ip addr add failed: external program exited with error status: 2
typoworx-de commented 4 years ago

Trying to figure out the issue I thought systemd-resolve --flush-caches could be the culprit on my Ubuntu 16.4 LTS linux (which doesn't know --flush-caches on systemd-resolve).

This may be a good addon to your script. I don't have nscd installed... this may need to be added as well.

flushdns() {
  systemd-resolve --flush-caches > /dev/null;

  test -x $(which dnsmasq) && {
    info "Restarting service dnsmasq";
    systemctl restart dnsmasq;
  }

  test -x $(/etc/init.d/dns-clean) && {
    info "Running /etc/init.d/dns-clean";
    /etc/init.d/dns-clean;
  }
}

indeed I was not able to fix my problem at all ... the script still breaks with Linux ip addr add failed: external program exited with error status: 2

typoworx-de commented 4 years ago

Is this script able to work with custom-tun/tap names? My tun device is named "tun-xyz"?

jonathanio commented 4 years ago

I'll have to take a look at the --flush-caches issue. It may be that it cannot be supported on that version of Ubuntu, and given it won't be supported for that much longer, not worth the additional work.

As to the tun/tap names - I use custom names with mine and it works fine. The name is passed into the script by OpenVPN.

tomeon commented 1 year ago

The cache-flushing issue should be solved by #99.

Not sure what to make of

Linux ip addr add failed: external program exited with error status: 2

Though I don't think it's coming directly from update-systemd-resolved, as that script does not call ip addr add.

@typoworx-de -- is this still an issue for you? Can you please try testing out the latest revision in the master branch?

TinCanTech commented 1 year ago

Linux ip addr add failed: external program exited with error status: 2

This come directly from openvpn. The OpenVPN config file is specifically configured to use external program ip, rather than a built-in method, which is non-standard, user configured.

A basic description of this can be found here.