multiple OpenVPN instances on a single tun
Hi,
I need to run multiple instances of OpenVPN server on just one tun device driver (say tun0) all on same subnets. I tried editing the open_tun function in tun.c file, first instance goes well and creates tun0 but when the second one comes along it cannot use tun0 and I get the error "ioctl(TUNSETIFF):
Device or resource busy ". I really need this functionality. Please give me some hints.
Thanks
Quoted 7 lines · ehsan enayati
Hi,
I need to run multiple instances of OpenVPN server on just one tun device driver (say tun0) all on same subnets. I tried editing theopen_tunfunction intun.cfile, first instance goes well and creates tun0 but when the second one comes along it cannot use tun0 and I get the error "ioctl(TUNSETIFF): Device or resource busy". I really need this functionality. Please give me some hints.
It is not possible to do what you try to do. Only one application can bind to a tun or tap socket. It's basically the same issue if you try to have more applications bind and listen to, say port 80, at the same time. It's impossible. And it's restricted by the OS.
If you need OpenVPN instances to be on the same subnet, you can use TAP and bridge tap0 and tap1 together. *But* I 'd rather recommend to use tun devices, have them on separate subnets and do the rest with routing.
Using tun + routing is by far the cleanest and easiest configuration
setups. It also gives the lowest traffic overhead and least headache while debugging the configuration when it fails.
Signature · 3 lines
kind regards, David Sommerseth
Hi,
Quoted 2 lines · ehsan enayati
I need to run multiple instances of OpenVPN server on just one tun device driver (say tun0) all on same subnets. I tried editing the
open_tunfunction intun.cfile, first instance goes well and creates tun0 but when the second one comes along it cannot use tun0 and I get the error "ioctl(TUNSETIFF):
Device or resource busy ". I really need this functionality. Please give me some hints.
There is no way to do this, as the tun device is exclusive-open - only a single process can open it (in theory, you might be able to open() it and then fork, sharing the file descriptor between all childs, but then you have the problem of ensuring that the "right" process gets the packets sent from the kernel to tun0, and there is no way to influence that).
Maybe you can explain to us what you want to achieve, and then we can see how it can be done (if at all).
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...Hi,
Quoted 2 lines · ehsan enayati
Thanks for your quick reply,
I'm running multiple OVPN instances on different subnets but the traffic isn't the same on all of these instances. some of them tolerate huge amount of traffic, hence I want to assign more than one OVPN to those subnets to balance traffic on them. I don't know it's possible or not.
It's not.
As David wrote: if it has to be the very same subnet, you could do multiple tap instances (tap0, tap1, tap2) and bridge them together (brctl).
Alternatively, you could split the subnet into smaller networks, and use multiple tuns.
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...Thanks for your replies. I just checked OpenVPN access server and saw that in "server network setting" and in protocol selection you can select Multi-Daemon mode. I thinks that's what exactly I need. Is it implemented via tun + routing?
________________________________
From: David Sommerseth <[email protected]...>
To: [email protected]
Sent: Monday, December 17, 2012 12:28 PM
Subject: Re: [Openvpn-devel] multiple OpenVPN instances on a single tun
Quoted 7 lines · ehsan enayati
Hi,
I need to run multiple instances of OpenVPN server on just one tun device driver (say tun0) all on same subnets. I tried editing theopen_tunfunction intun.cfile, first instance goes well and creates tun0 but when the second one comes along it cannot use tun0 and I get the error "ioctl(TUNSETIFF): Device or resource busy". I really need this functionality. Please give me some hints.
It is not possible to do what you try to do. Only one application can bind to a tun or tap socket. It's basically the same issue if you try to have more applications bind and listen to, say port 80, at the same time. It's impossible. And it's restricted by the OS.
If you need OpenVPN instances to be on the same subnet, you can use TAP and bridge tap0 and tap1 together. *But* I 'd rather recommend to use tun devices, have them on separate subnets and do the rest with routing. Using tun + routing is by far the cleanest and easiest configuration setups. It also gives the lowest traffic overhead and least headache while debugging the configuration when it fails.
Signature · 15 lines
kind regards, David Sommerseth ------------------------------------------------------------------------------ LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d _______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Hi,
Quoted 4 lines · ehsan enayati
Thanks for your replies. I just checked OpenVPN access server and saw that in "server network setting" and in protocol selection you can select Multi-Daemon mode. I thinks that's what exactly I need. Is it implemented via tun + routing?
No idea about AS -> ask your support contacts.
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...