This how-to is designed to assist with setting up WireGuard on OPNsense to use selective routing to an external VPN provider.
This how-to is designed to assist with setting up WireGuard on OPNsense to use selective routing to an external VPN endpoint - most commonly to an external VPN provider.
These circumstances may apply where only certain local hosts are intended to use the VPN tunnel. Or it could apply where multiple connections to the VPN provider are desired, with each connection intended to be used by different specific local hosts.
@ -188,9 +188,36 @@ It should be noted, however, that if the hosts that will use the tunnel are conf
- **Save** the rule, and then click **Apply Changes**
- Then make sure that the new rule is **above** any other rule on the interface that would otherwise interfere with its operation. For example, you want your new rule to be above the “Default allow LAN to any rule”
------------------------------------
Step 9 - Create an outbound NAT rule
------------------------------------
--------------------------
Step 9 - Configure routing
--------------------------
- Then go to :menuselection:`Firewall --> Rules --> Floating`
- Click **Add** to add a new rule
- Configure the rule as follows (if an option is not mentioned below, leave it as the default). You need to click the **Show/Hide** button next to "Advanced Options" to reveal the last setting:
- **Save** the rule, and then click **Apply changes**
--------------------------------------
Step 10 - Add a kill switch (optional)
--------------------------------------
If the VPN tunnel gateway goes offline, then traffic intended for the VPN may go out the normal WAN gateway. There are a couple of ways to avoid this, one of which is outlined here:
- First, go back to the firewall rule you created under Step 7
- Click on the **Show/Hide** button next to "Advanced Options"
- Then, in the **Set local tag** field, add :code:`NO_WAN_EGRESS`
- **Save** the rule, and then click **Apply changes**
- Then go to :menuselection:`Firewall --> Rules --> Floating`
- Click **Add** to add a new rule
- Configure the rule as follows (if an option is not mentioned below, leave it as the default). You need to click the **Show/Hide** button next to "Advanced Options" to reveal the last setting: