Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to run two OpenVPN client instances on an Ubuntu Server 14.04. I have both .conf files that can work independently (both are set to different interfaces - tun0 and tun1). I want to run both at the same time, and route traffic from one application into one VPN (Private Internet Access) and all other traffic into the other VPN (An OpenVPN server I have set up on another machine).

I've been doing some research but haven't found a way to make this work. If this helps, I've included my current routing table and one of the server .confs. OpenVPN starts them automatically on boot.

Private Internet Access .conf

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default       UG    0      0        0 tun0
default         UG    0      0        0 eth0 UGH   0      0        0 tun0      *      UH    0      0        0 tun0
64-237-37-119.c UGH   0      0        0 eth0       UG    0      0        0 tun0    *        U     0      0        0 eth0
share|improve this question
What networks are tun0 and tun1 connected to? – Kromey May 7 '14 at 1:09

You need to add routes for your applications via the tunnels.

For example, if application A is at, and you want to route application A via Private Internet Access, you should run this command:

route add gw "IP address of gateway at PIA"

Then, to route all other traffic via other VPN, you need to do two things:

  1. Route traffic to the other VPN server via your normal default gateway

    route add "IP address of other VPN server" gw

Here I assume this is your normal default gateway, based on your routing table in your post.

  1. Make a default route via other VPN server gateway

    route add default gw "Other VPN server gateway IP"

Remember that both OpenVPN servers need to do NAT in order for return packets to arrive correctly via the VPN.

share|improve this answer
This might sound stupid, but how do I find the IP address of the application? I'm sure I understand that. I have a Deluge server, would I just use localhost:port to forward the traffic through PIA? – Ian H May 7 '14 at 2:58
While running the application, you can run netstat -np in a shell to see where the application connects to. Then you can route that destination IP via one VPN. – Tero Kilkanen May 7 '14 at 13:08
Okay, so this is my deluge daemon: <br/> tcp 0 0 ESTABLISHED - Would I then use route add gw "IP address of gateway at PIA"? Or would I use the foreign address? – Ian H May 7 '14 at 15:58
This deluge daemon doesn't communicate anywhere outside your network, so you cannot route it anywhere with OpenVPN. It seems that your original question lacks a lot of information in order to answer it properly. – Tero Kilkanen May 7 '14 at 19:35
It does send traffic outside the network, but it's all bitorrent traffic, it doesn't go to a single address. – Ian H May 7 '14 at 19:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.