You are not logged in.

#1 2016-05-20 11:45:35

sjoerd
Member
Registered: 2014-10-08
Posts: 2

openvpn refuses to use persistent tun device created by systemd

openvpn has the possibility to use a persistent tun device created using:

openvpn --mktun --dev tun0

I would like this to happen on boot. (i.e. I have multiple instances of openvpn running (one client and one server) and I want the devices to be fixed)
Systemd-networkd can create these persistent devices as well by creating a file in

/etc/systemd/network/tun0.netdev

with the contents:

[NetDev]
Name=tun0
Kind=tun

[Tun]
MultiQueue=true
PacketInfo=true

However, when I point openvpn to that tun device (either using the "dev" option in the config or the --dev option on the command line) it says:

Fri May 20 11:39:30 2016 ERROR: Cannot ioctl TUNSETIFF tun0: Invalid argument (errno=22)
Fri May 20 11:39:30 2016 Exiting due to fatal error

Just after creation the devices look similar in the output of

ip addr show

, so I guess openvpn does something "extra" when it creates the node. However, I had a quick look at the output of

strace openvpn --mktun --dev tun0

and nothing gets written...

The strange thing is that this only occurs with the client instance of openvpn. The server (same mechanism) runs fine with the systemd created tun device, even when I swap tun0 and tun1...

Any idea? Any suggestions?

Offline

Board footer

Powered by FluxBB