Opened 9 years ago

Closed 5 years ago

#544 closed Bug / Defect (worksforme)

Simultaneous multiple VPNs cause route command failure

Reported by: yurivict Owned by:
Priority: major Milestone:
Component: Generic / unclassified Version: OpenVPN 2.3.6 (Community Ed)
Severity: Not set (select this one, unless your'e a OpenVPN developer) Keywords:
Cc:

Description

From the first VPN connection I am trying to connect to the other VPN. It performs the handshake ok, but breaks on an attempt to add routes.

It turns out that OpenVPN adds such routes:
0.0.0.0/1 <NEW-GW>
128.0.0.0/1 <NEW-GW>
in order to introduce the new GW on top of the existing one.

The second VPN tries to repeat the same and fails. The second process should understand that new GW has been already added, and should add the next best available option:
0.0.0.0/2 <NEW-GW>
64.0.0.0/2 <NEW-GW>
128.0.0.0/2 <NEW-GW>
192.0.0.0/2 <NEW-GW>
And so on and so forth, it will be reasonable to be able to do this this at least up to 3-4 (/1 .. /4).

Another very bad problem is that when the second connection failed, it left it in non-functional mode. When I pressed Ctrl-C, the second connection still went ahead and deleted these two gw bypass routes, which it didn't create. And this rendered the first VPN connection unusable.

So there are three problems:

  1. GW bypass route should choose the best available option, up to ~/4
  2. VPN shouldn't tolerate failure of 'route' command, and should dismantle VPN altogether since it isn't functional anyway. So VPN should be either fully "on", or fully "off". Currently OpenVPN leaves VPN dysfunctional when route rails.
  3. OpenVPN process should never attempt to delete routes it did not create

Change History (10)

comment:1 Changed 9 years ago by Gert Döring

Doing "redirect-gateway" on two VPNs at the same time is a non-useful configuration - just don't do it.

Either just route the specific gateway address of the second VPN into the first VPN, or whatever you need into the second VPN, and things will work just fine.

I do agree that we should consider failure to add routes as "fatal" and not go ahead (and remember that we couldn't create the route). Normally we should, but it might be that this isn't working for your particular platform and combination of options - care to share a log file (with 2.3.6, not 2.2.2 as that is quite old)?

comment:2 Changed 9 years ago by yurivict

The version I used is 2.3.6.

The logs wouldn't reveal anything useful beyond what was said. The second connection goes the successful route until /sbin/route says it can't create the route, and it stops (in non-functional state). Then Ctrl-C causes a disaster.

I would also like to note that the idea of using double or even triple VPN is quite popular and gets mentioned quite a bit. So I was amazed to find it failing with OpenVPN when I tried it.

comment:3 Changed 9 years ago by Gert Döring

Version: 2.2.22.3.6

Knowing the OS used would help, for a start... /sbin/route suggests it is not Windows, but it could still be MacOS, FreeBSD, ...

Double-or-triple-VPN is something which would work, but redirecting the default gateway multiple times is not overly useful, and thus, not supported today. It might work if you do not use the "def1" flag to "redirect-gateway" (which is what makes it install the /1 routes)

comment:4 Changed 9 years ago by yurivict

The OS is FreeBSD.

So I should change def1 to def2?

comment:5 Changed 9 years ago by Gert Döring

leave out "def1", then it will save and restore the pre-existing default route - which can have issues in DHCP environments, which is why the def1 hack is there.

comment:6 Changed 9 years ago by Gert Döring

Duplicate of #504 (with more detail here)

comment:7 Changed 8 years ago by debbie10t

Ideal use case for:--pull-filter ignore "redirect-gateway "

comment:8 in reply to:  1 ; Changed 5 years ago by tct

Replying to Gert Döring:

Doing "redirect-gateway" on two VPNs at the same time is a non-useful configuration - just don't do it.

This is the best advice.

comment:9 in reply to:  8 ; Changed 5 years ago by yurivict

Replying to tincantech:

Replying to Gert Döring:

Doing "redirect-gateway" on two VPNs at the same time is a non-useful configuration - just don't do it.

This is the best advice.

Multiply-connected VPNs begin to make a lot of sense once the degree of paranoidness exceeds certain threshold. Not me, but there are a lot of such people.

comment:10 in reply to:  9 Changed 5 years ago by Gert Döring

Resolution: worksforme
Status: newclosed

Replying to yurivict:

Multiply-connected VPNs begin to make a lot of sense once the degree of paranoidness exceeds certain threshold.

Even so, you can only redirect your gateway to *one* VPN.

You can have "one VPN in a different VPN", which might or might not satisfy the paranoia requirements, but in that case you point VPN gateway #2 into VPN #1, and the default only goes to VPN #2.

Or you can have two VPNs active at the same time, but in this case you need to decide on "which route goes where". So, doing "redirect-gateway" twice will never cause what you assume it does.

Anyway, since I'm still waiting for the log file with the very specific details of what OpenVPN did, and what "disaster" specifically means, and the OpenVPN version in this ticket is over 5 years old, I'll just close this ticket now.

If you want us to consider a code change, provide a log file of the then-current version (2.4.8).

Note: See TracTickets for help on using tickets.