I have a setup with two ethernet connections. I'm trying to configure it so that one of the interfaces (eth1) is configured for use with OpenVPN and is not a default route for anything. (Connections to the VPN interface would be controlled by manually selecting it on the application level.)

Its also important that the setup not interfere with incoming traffic on the non-VPN interface (i.e. remote ssh connections, etc).

Anyone know how to set up such an environment?

(My system is running Ubuntu 15.10.)

1 Answer 1


First upgrade from 15.04. It's dead and vulnerable to attack.

Secondly, I'd strongly recommend doing this with in an LXC container (or with Docker, which uses LXC). A container limits anything within it to whatever you like, including network stuff.

That way you can force OpenVPN onto a certain network interface. And then force a load of applications to use the VPN. All without disrupting the main network connection and everything outside the container. For granular access, you can run a proxy within the container and expose that to your host computer's applications.

It isn't trivial though. Currently it involves using privileged containers (okay but not ideal) and there are several hacks you have to do to make it all work. The most complete guide on the matter is here but an amount of Googling around "lxc vpn" will help.

  • I running Wiley, I forgot which version number that was (the post has been editted). I'll definitely look into LXC.
    – SamWN
    Feb 19, 2016 at 13:48
  • As usual, the ArchWiki's instructions have been extremely useful: Linux Containers and OpenVPN in Linux containers. Considering that it's written for Arch, there are, of course, a few differences the in the configuration process, but it's around 98% same same procedure.
    – SamWN
    Feb 20, 2016 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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