This is a guide on smoothly transitioning away from your OPNsense OpenVPN server legacy setup without forcing clients to change or update their configuration. This is not a guide on how to set up OpenVPN on OPNsense.
OPNsense is sunsetting the original OpenVPN configuration. If, like me, you are running OpenVPN on OPNSense to provide a tunnel for remote clients, this guide is for you.
- You are running OPNSense 24.7.9 or higher.
- Old OpenVPN server settings are under VPN → OpenVPN → Servers [legacy].
- You were running a tunnel configured using the
IPv4 Tunnel Networksetting. - You had the
Redirect Gatewayoption set: this forces all traffic on the client to go through the VPN.
I suggest you do not delete the legacy server setup but disable it until your new setup is working.
- Go to VPN → OpenVPN → Servers [legacy].
- Press the green
▶️ button to disable the server; the button turns grey.
You can skip this phase if you do not have TLS Authentication enabled in your legacy OpenVPN server.
- Go to VPN → OpenVPN → Servers [legacy].
- Copy the
TLS Shared Keyto the clipboard. - Go to VPN → OpenVPN → Instances and select the
Static Keystab at the top of the page. - Press the orange
+icon near the right of the page to add a key. - Set a
Description, leaveModetocrypt. - Paste the value you copied to the clipboard to the
Static Keyfield.
- Go to VPN → OpenVPN → Instance and select the
Instancestab at the top of the page. - Press the orange
+icon near the right of the page to add an OpenVPN instance. - Enable
advanced modeusing the toggle near the top left of the page. - Accept all defaults unless otherwise mentioned below.
- Set
Descriptionto whatever you like, but I initially set it toOpenVPN - New. - Set
Server (IPv4)to192.168.2.0/24or some other IP range that does not overlap with local OPNsense clients. - Set
Certificateto the same value as the oldServer Certificatevalue (under VPN → OpenVPN → Servers [legacy]). - Only relevant if you had it set in your legacy server: Under
TLS static key, choose the key you added inPhase 1above when you copy/pasted the TLS Static Key. - Under
Options, setduplicate-cnto allow multiple clients with the same certificate to connect simultaneously. You should not set this if you want to force a previously connected client to disconnect if the same client connects again. This would force an at-most-one connection for a user. - Under
Push Options, select bothpush block-outside-dnsandpush register-dns. - Under
Redirect Gateway, selectdefault. - Press the
Savebutton. - Press the
Applybutton.
- Go to Firewall → Rules → OpenVPN.
- If you already had a rule for
10.0.8.0/24(or something along those lines), duplicate it, edit it, and ensure it matches192.168.2.0/24or whatever IP range you configured above. Otherwise, add it. (The rule needs to allowintraffic for192.168.2.0/24)
Once you have confirmed all works...
- Remove the legacy server under VPN → OpenVPN → Servers [legacy].
- Remove the stale firewall rule under Firewall → Rules → OpenVPN.