Using OpenVPN

OpenVPN is a full SSL VPN solution that allows you to connect two networks at layer 2 or 3 via a TCP or UDP tunnel. It is available on https://openvpn.net/ or via your distributions package repositories.

OpenVPN offers a number of options for authentication. We're going to set up a simple configuration, which will get you up and running. From there, there are multiple options, which you may want to consider for your needs.

How to do it…

  1. Install OpenVPN on the server with sudo apt-get install openvpn for Debian derivatives like Ubuntu, or sudo yum install openvpn.
  2. Generate a static key:
    openvpn --genkey --secret /etc/openvpn/static.key
    
  3. Set up the server configuration. You can see examples in /usr/share/doc/openvpn/examples/sample-config-files ...

Get Linux Networking Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.