OpenVPN: Connect your LANs over the Internet

Run OpenVPN

by ross at 09:03:03 on April 7, 2017

Using rc.d scripts

OpenVPN port comes with openvpn rc.d script. It allowes multiple instances of OpenVPN daemon to run on single host.

You use it like this (on both the server and client):

# cd /usr/local/etc/rc.d
# ln -s openvpn openvpn_officelan

You have created openvpn_officelan rc.d script (actually just a symlink of course), now add to /etc/rc.conf:

openvpn_officelan_enable="YES"
openvpn_officelan_if="tun"

Use tun for routed setup or replace with tap for bridged.

You should create a .conf file in /usr/local/etc/openvpn with the same name, i.e. /usr/local/etc/openvpn/openvpn_officelan.conf in this case.

Start

On the server and the client:

# service openvpn_officelan start

Troubleshooting

  • Sometimes running the rc.d start command will not be enough. If you can't ping the other side run arp -da on both the server and the client after they have established connection. And then try to ping.
  • Try to disable firewalls completely while testing if you still can't ping the other side internal hosts via VPN.
  • If you often loose connection you could add keepalive 10 60 option both to the server and to the clients in order to enable continuous monitoring of the connection by the daemon.

The complete documentation for OpenVPN is here.

 

Comments