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.Dismiss alert
The call looks correct to me: 7 is the ifindex, 2 array entries, 2 entries in the first slow, IPv4, four octets. There's nothing that appears to be wrong with that setting.
If you disable the up command, connect, and then run ip link show tun0, the first number is the ifindex. Then run (replacing {ifindex} with the number):
Got it!
I used to have
[Match]
Name=wlan0
[Network]
DHCP=yes
in my .network file.
Recently I removed Name=wlan0 line to let systemd configure all interfaces.
That was it, after I added it back it worked again.
Thanks!
This is an interesting one as I think that will need to be escalated to the OpenVPN packaging team within CentOS/RHEL. It will be important to allow access to this for the daemon, especially as there has been discussion I believe around getting OpenVPN to update the systemd-resolved.service from within OpenVPN itself.
That looks like either systemd-resolved.service isn't running, or you do not have a recent-enough version of systemd to provide the DNS interface via DBus. What version of systemd are you running?
systemctl --version please and let me know the output - this will confirm the version you are running;
systemctl status systemd-resolved.service to check the status of the service; and
You imply [user@server path]$ above - only the root user can update the DNS currently. Can you confirm that the openvpn service, and hence the script on connection, are running as root also?
that was just me blanking out everything for the www.
[user@serverXYZ .somefolder]$ yum info systemd-resolved
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: repos-tx.psychz.net
* epel: pubmirror2.math.uh.edu
* extras: mirror.oss.ou.edu
* updates: mirror.dal10.us.leaseweb.net
Installed Packages
Name : systemd-resolved
Arch : x86_64
Version : 219
Release : 30.el7_3.9
Size : 1.0 M
Repo : installed
From repo : updates
Summary : Network Name Resolution manager.
URL : http://www.freedesktop.org/wiki/Software/systemd
License : LGPLv2+
Description : systemd-resolved is a system service that manages network name resolution.
: It implements a caching DNS stub resolver and an LLMNR resolver and responder.
[user@serverXYZ .somefolder]$ sudo systemctl status systemd-resolved
● systemd-resolved.service - Network Name Resolution
Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service; disabled; vendor preset: disabled)
Active: active (running) since Thu 2017-08-17 10:21:22 CDT; 29s ago
Docs: man:systemd-resolved.service(8)
Main PID: 553 (systemd-resolve)
Status: "Processing requests..."
CGroup: /system.slice/systemd-resolved.service
└─553 /usr/lib/systemd/systemd-resolved
Aug 17 10:21:22 serverXYZ.home.local systemd[1]: Starting Network Name Resolution...
Aug 17 10:21:22 serverXYZ.home.local systemd-resolved[553]: Using system hostname 'serverXYZ.home.local'.
Aug 17 10:21:22 serverXYZ.home.local systemd-resolved[553]: Switching to system DNS server 192.168.1.1.
Aug 17 10:21:22 serverXYZ.home.local systemd[1]: Started Network Name Resolution.
[user@serverXYZ .somefolder]$ sudo openvpn AirVPN_Netherlands_UDP-443.ovpn
[sudo] password for user:
Thu Aug 17 10:33:02 2017 OpenVPN 2.4.3 x86_64-redhat-linux-gnu [Fedora EPEL patched] [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Jun 21 2017
Thu Aug 17 10:33:02 2017 library versions: OpenSSL 1.0.1e-fips 11 Feb 2013, LZO 2.06
etc etc etc...
[user@serverXYZ ~]$ ip link show tun0
12: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN mode DEFAULT qlen 100
link/none
And this - not knowing exactly what privileges are required - I ran with and without sudo with same result:
Ok, I'm on Fedora 26 now. I think I'm closer this time, but its not setting DNS. Here is some output from connecting, cat /etc/resolv.conf and nslookup. I'm not getting my DNS server.
[user@Fedora26 folder]$ sudo openvpn AirVPN_Netherlands_UDP-443.ovpn &
[1] 17801
[user@Fedora26 folder]$ Thu Aug 17 19:41:18 2017 OpenVPN 2.4.3 x86_64-redhat-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Jun 21 2017
Thu Aug 17 19:41:18 2017 library versions: OpenSSL 1.0.2j-fips 26 Sep 2016, LZO 2.08
Thu Aug 17 19:41:18 2017 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
Thu Aug 17 19:41:18 2017 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Thu Aug 17 19:41:18 2017 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Thu Aug 17 19:41:18 2017 TCP/UDP: Preserving recently used remote address: [AF_INET]213.152.161.137:443
Thu Aug 17 19:41:18 2017 Socket Buffers: R=[212992->212992] S=[212992->212992]
Thu Aug 17 19:41:18 2017 UDP link local: (not bound)
Thu Aug 17 19:41:18 2017 UDP link remote: [AF_INET]213.152.161.137:443
Thu Aug 17 19:41:18 2017 TLS: Initial packet from [AF_INET]213.152.161.137:443, sid=0a983fd6 620dabf5
Thu Aug 17 19:41:19 2017 VERIFY OK: depth=1, C=IT, ST=IT, L=Perugia, O=airvpn.org, CN=airvpn.org CA, [email protected]
Thu Aug 17 19:41:19 2017 VERIFY KU OK
Thu Aug 17 19:41:19 2017 Validating certificate extended key usage
Thu Aug 17 19:41:19 2017 ++ Certificate has EKU (str) TLS Web Server Authentication, expects TLS Web Server Authentication
Thu Aug 17 19:41:19 2017 VERIFY EKU OK
Thu Aug 17 19:41:19 2017 VERIFY OK: depth=0, C=IT, ST=IT, L=Perugia, O=airvpn.org, CN=server, [email protected]
Thu Aug 17 19:41:19 2017 Control Channel: TLSv1.2, cipher TLSv1/SSLv3 DHE-RSA-AES256-GCM-SHA384, 4096 bit RSA
Thu Aug 17 19:41:19 2017 [server] Peer Connection Initiated with [AF_INET]213.152.161.137:443
Thu Aug 17 19:41:20 2017 SENT CONTROL [server]: 'PUSH_REQUEST' (status=1)
Thu Aug 17 19:41:20 2017 PUSH: Received control message: 'PUSH_REPLY,redirect-gateway def1 bypass-dhcp,dhcp-option DNS XX.XX.XX.XX,comp-lzo no,route-gateway XX.XX.XX.XX,topology subnet,ping 10,ping-restart 60,ifconfig XX.XX.XX.XX 255.255.0.0'
Thu Aug 17 19:41:20 2017 OPTIONS IMPORT: timers and/or timeouts modified
Thu Aug 17 19:41:20 2017 OPTIONS IMPORT: compression parms modified
Thu Aug 17 19:41:20 2017 OPTIONS IMPORT: --ifconfig/up options modified
Thu Aug 17 19:41:20 2017 OPTIONS IMPORT: route options modified
Thu Aug 17 19:41:20 2017 OPTIONS IMPORT: route-related options modified
Thu Aug 17 19:41:20 2017 OPTIONS IMPORT: --ip-win32 and/or --dhcp-option options modified
Thu Aug 17 19:41:20 2017 Data Channel Encrypt: Cipher 'AES-256-CBC' initialized with 256 bit key
Thu Aug 17 19:41:20 2017 Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Thu Aug 17 19:41:20 2017 Data Channel Decrypt: Cipher 'AES-256-CBC' initialized with 256 bit key
Thu Aug 17 19:41:20 2017 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
Thu Aug 17 19:41:20 2017 ROUTE_GATEWAY 192.168.1.1/255.255.255.0 IFACE=ens192 HWADDR=XX:XX:XX:XX:XX:XX
Thu Aug 17 19:41:20 2017 TUN/TAP device tun0 opened
Thu Aug 17 19:41:20 2017 TUN/TAP TX queue length set to 100
Thu Aug 17 19:41:20 2017 do_ifconfig, tt->did_ifconfig_ipv6_setup=0
Thu Aug 17 19:41:20 2017 /sbin/ip link set dev tun0 up mtu 1500
Thu Aug 17 19:41:20 2017 /sbin/ip addr add dev tun0 XX.XX.XX.XX/16 broadcast XX.XX.255.255
Thu Aug 17 19:41:20 2017 /etc/openvpn/scripts/update-systemd-resolved tun0 1500 1558 XX.XX.XX.XX 255.255.0.0 init
<14>Aug 17 19:41:20 update-systemd-resolved: Link 'tun0' coming up
<14>Aug 17 19:41:20 update-systemd-resolved: Adding IPv4 DNS Server XX.XX.XX.XX
<14>Aug 17 19:41:20 update-systemd-resolved: SetLinkDNS(4 1 2 4 XX XX XX XX)
Thu Aug 17 19:41:25 2017 /sbin/ip route add 213.152.161.137/32 via 192.168.1.1
Thu Aug 17 19:41:25 2017 /sbin/ip route add 0.0.0.0/1 via XX.XX.XX.XX
Thu Aug 17 19:41:25 2017 /sbin/ip route add 128.0.0.0/1 via XX.XX.XX.XX
Thu Aug 17 19:41:25 2017 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
Thu Aug 17 19:41:25 2017 Initialization Sequence Completed
[user@Fedora26 folder]$ cat /etc/resolv.conf
# Generated by NetworkManager
search home.local
nameserver 192.168.1.1
nameserver 8.8.8.8
[user@Fedora26 folder]$ nslookup airvpn.org
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
Name: airvpn.org
Address: 5.196.64.52
;; Warning: Message parser reports malformed message packet.
;; Got recursion not available from 192.168.1.1, trying next server
Name: airvpn.org
Address: 2001:41d0:a:6034::
And I get no output from:
[user@Fedora26 folder]$ ip link show tun0
5: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN mode DEFAULT group default qlen 100
link/none
[user@Fedora26 folder]$ sudo busctl call org.freedesktop.resolve1 /org/freedesktop/resolve1 org.freedesktop.resolve1.Manager SetLinkDNS 'ia(iay)' 5 2 2 4 193 181 14 10 2 4 193 181 14 11
@khuffmanjr -- I might be missing something here, but it seems like your /etc/resolv.conf is being managed by NetworkManager rather than systemd-resolved. If you want to use systemd-resolved, you should ensure that /etc/resolv.conf is a symlink to /usr/lib/systemd/resolv.conf (it might be a different path on your system; I'm on Arch Linux). You can add 192.168.1.1 and 8.8.8.8 to /etc/systemd/resolved.conf as upstream resolvers:
[Resolve]DNS=192.168.1.1 8.8.8.8
# or if you want to use resolvers configured by systemd-networkd, falling back to these as defaults:FallbackDNS=192.168.1.1 8.8.8.8
The same problem happened to me recently. I checked everything that is mentioned on this page, but still got the Link tun0 is managed. I think, but certainly not sure that /lib/systemd/network/99-default.link is to blame!
however the solution was to create a file (which I named tun.network) in /etc/systemd/network with the following content
[Match]
Name=tun*
[Link]
Unmanaged=yes
Restarted systemd-networkd and update-systemd-resolved worked without any more problems.
This makes senese, since tun devices are mostly created using external programs.
Have a basic POC that's working for me on Arch Linux. Put this in a .rules file under /etc/polkit-1/rules.d; e.g., /etc/polkit-1/rules.d/10-update-systemd-resolved.rules:
/* Allow OpenVPN client services to update systemd-resolved settings */polkit.addRule(function(action,subject){if(subject.user=="openvpn"&&action.id.startsWith("org.freedesktop.resolve1.")){varns=action.id.split(".");varsubaction=ns[ns.length-1];if(subaction=="set-dns-servers"||subaction=="set-domains"||subaction=="set-dnssec"||subaction=="revert"){returnpolkit.Result.YES;}}});
Note that this is just an initial stab at the issue; needs better access control (like checking the name of the unit to make sure it matches openvpn-client@, or something).
Activity
jonathanio commentedon Sep 1, 2016
@ezhukov,
The call looks correct to me: 7 is the
ifindex, 2 array entries, 2 entries in the first slow, IPv4, four octets. There's nothing that appears to be wrong with that setting.If you disable the
upcommand, connect, and then runip link show tun0, the first number is theifindex. Then run (replacing{ifindex}with the number):and let me know what it says?
I use it on three different VPNs myself and no issues so far, so I would like to work this out. :)
ezhukov commentedon Sep 1, 2016
It says:
Link tun0 is managed.
jonathanio commentedon Sep 1, 2016
In that case, can you try:
where
{ifindex}is as found before (but make sure you add 30 to the number).Additionally, do you have a
.networkor.netdevfile undersystemd-networkdwhich matchestun0?ezhukov commentedon Sep 1, 2016
Got it!
I used to have
[Match]
Name=wlan0
[Network]
DHCP=yes
in my .network file.
Recently I removed Name=wlan0 line to let systemd configure all interfaces.
That was it, after I added it back it worked again.
Thanks!
jonathanio commentedon Sep 1, 2016
@ezhukov,
Brill! Thanks for the report nonetheless and glad we found the issue.
piotr-dobrogost commentedon Jan 29, 2017
I was getting the same error (
busctl exited with status 1) but the reason was selinux blocking dbus call with the following entry in journalctl:jonathanio commentedon Jan 30, 2017
This is an interesting one as I think that will need to be escalated to the OpenVPN packaging team within CentOS/RHEL. It will be important to allow access to this for the daemon, especially as there has been discussion I believe around getting OpenVPN to update the
systemd-resolved.servicefrom within OpenVPN itself.piotr-dobrogost commentedon Jan 30, 2017
By update the systemd-resolved.service you don't mean updating unit file, do you?
Do you have a link to this discussion?
I found issue with selinux blocking dbus calls from --up/--down script raised at https://bugzilla.redhat.com/show_bug.cgi?id=1415155
Home of openvpn package for Fedora/EPEL – https://apps.fedoraproject.org/packages/openvpn/bugs
jonathanio commentedon Jan 30, 2017
@piotr-dobrogost,
Sorry, bad wording on my part: By update
systemd-resolved.serviceI mean via DBus rather than the unit file itself. As for the discussion: https://community.openvpn.net/openvpn/ticket/753. It's more that's it's been flagged and is being considered I suppose as part of further integration within systemd.khuffmanjr commentedon Aug 16, 2017
I'm getting the same error. When I try to invoke busctl from above, I get:
[user@server path]$ busctl call org.freedesktop.resolve1 /org/freedesktop/resolve1 org.freedesktop.resolve1.Manager SetLinkDNS 'ia(iay)' 6 2 2 4 193 181 14 10 2 4 193 181 14 11 Unknown method 'SetLinkDNS' or interface 'org.freedesktop.resolve1.Manager'.jonathanio commentedon Aug 17, 2017
@khuffmanjr,
That looks like either
systemd-resolved.serviceisn't running, or you do not have a recent-enough version ofsystemdto provide the DNS interface via DBus. What version ofsystemdare you running?khuffmanjr commentedon Aug 17, 2017
1 remaining item
jonathanio commentedon Aug 17, 2017
@khuffmanjr,
Can you run:
systemctl --versionplease and let me know the output - this will confirm the version you are running;systemctl status systemd-resolved.serviceto check the status of the service; and[user@server path]$above - only therootuser can update the DNS currently. Can you confirm that theopenvpnservice, and hence the script on connection, are running asrootalso?khuffmanjr commentedon Aug 17, 2017
that was just me blanking out everything for the www.
And this - not knowing exactly what privileges are required - I ran with and without sudo with same result:
And, for good measure:
jonathanio commentedon Aug 17, 2017
@khuffmanjr,
I'm afraid you require
systemd-229as a minimum. The DBus interface forsystemd-resolved.servicewas not added until then.khuffmanjr commentedon Aug 17, 2017
Yikes, ok. I'll have a look around then. Thanks for the answer and for your work on this project.
jonathanio commentedon Aug 17, 2017
No problem. Thanks.
khuffmanjr commentedon Aug 18, 2017
Ok, I'm on Fedora 26 now. I think I'm closer this time, but its not setting DNS. Here is some output from connecting, cat /etc/resolv.conf and nslookup. I'm not getting my DNS server.
And I get no output from:
And I should be on a good version of systemd:
tomeon commentedon Aug 18, 2017
@khuffmanjr -- I might be missing something here, but it seems like your
/etc/resolv.confis being managed by NetworkManager rather than systemd-resolved. If you want to use systemd-resolved, you should ensure that/etc/resolv.confis a symlink to/usr/lib/systemd/resolv.conf(it might be a different path on your system; I'm on Arch Linux). You can add 192.168.1.1 and 8.8.8.8 to/etc/systemd/resolved.confas upstream resolvers:khuffmanjr commentedon Aug 18, 2017
well darn. Maybe NetworkManager needs to go - too bad, I was just getting into nmcli. systemd-networkd, here I come.
Thanks sir.
sasanj commentedon Nov 13, 2018
The same problem happened to me recently. I checked everything that is mentioned on this page, but still got the
Link tun0 is managed. I think, but certainly not sure that/lib/systemd/network/99-default.linkis to blame!however the solution was to create a file (which I named
tun.network) in/etc/systemd/networkwith the following contentRestarted
systemd-networkdandupdate-systemd-resolvedworked without any more problems.This makes senese, since
tundevices are mostly created using external programs.piotr-dobrogost commentedon Jan 2, 2019
Problem with SELinux blocking dbus calls from the script (which I described earlier in this thread) is still present in Fedora 29 with openvpn.x86_64 2.4.6-3.fc29 installed. As https://bugzilla.redhat.com/show_bug.cgi?id=1415155 was closed due to EOL of Fedora 24 I raised this again at https://bugzilla.redhat.com/show_bug.cgi?id=1662909
tomeon commentedon Nov 20, 2020
Looks like this might require a Polkit rule; looking into it.
tomeon commentedon Nov 20, 2020
Have a basic POC that's working for me on Arch Linux. Put this in a
.rulesfile under/etc/polkit-1/rules.d; e.g.,/etc/polkit-1/rules.d/10-update-systemd-resolved.rules:Note that this is just an initial stab at the issue; needs better access control (like checking the name of the unit to make sure it matches
openvpn-client@, or something).