Use IPsec the OpenBSD way.
Setting up IPsec in OpenBSD is fairly easy since it’s compiled into the kernel that ships with each release and is enabled by default. All that is left to do is to create the appropriate /etc/isakmpd/isakmpd.conf and /etc/isakmpd/isakmpd.policy files and start isakmpd (the IPsec key-management daemon). This may sound daunting, but OpenBSD’s outstanding documentation and example configuration files make it easier.
First of all, you’ll need to put something similar to this in your /etc/isakmpd/isakmpd.policy:
Conditions: app_domain == “IPsec policy” &&
esp_present == “yes” &&
esp_enc_alg == “aes” &&
esp_auth_alg == “hmac-sha” -> “true”;
This sets a password to use for the IPsec connection.
Now you’ll need to edit your /etc/isakmpd/isakmpd.conf to contain the following:
This configuration will allow anyone to connect with the password mypassword.
After you’ve edited the configuration files, you can start isakmpd by running this command:
To have isakmpd start up with each system boot, you should edit your /etc/rc.conf.local (or create one if it doesn’t exist) and put the following line in it:
That should do it. As usual, check your system logs if your tunnel has trouble connecting.