|
| 1 | +--- |
| 2 | +icon: dungeon |
| 3 | +--- |
| 4 | + |
| 5 | +# OPNsense |
| 6 | + |
| 7 | +[OPNsense®](https://opnsense.org/) is an open source, feature rich firewall and routing platform, offering cutting-edge network protection. |
| 8 | + |
| 9 | +## Defguard Gateway Configuration |
| 10 | + |
| 11 | +This instruction helps configuring Defguard Gateway in OPNsense. This is based on [WireGuard Road Warrior Setup](https://docs.opnsense.org/manual/how-tos/wireguard-client.html) from OPNsense documentation. |
| 12 | + |
| 13 | +### Configure Defguard Gateway plugin |
| 14 | + |
| 15 | +1. Go to **VPN → Defguard Gateway** |
| 16 | +2. Fill out the approriate values in the form |
| 17 | +3. Eventually, **Start/Restart** the service. |
| 18 | + |
| 19 | +<figure><img src="../../../.gitbook/assets/OPNSense Plugin.png" alt="OPNSense plugin"><figcaption></figcaption></figure> |
| 20 | + |
| 21 | +### Assign a network interface to Defguard |
| 22 | + |
| 23 | +1. Go to **Interfaces → Assignments** |
| 24 | +2. Under **Assign a new interface**, select the Defgaurd Gateway network interface (e.g. _wg0_) |
| 25 | +3. Add a descrption, for example _ParisOfficeVPN_ |
| 26 | +4. Click **Add** |
| 27 | + |
| 28 | +<figure><img src="../../../.gitbook/assets/OPNSense-interface-assignments.png" alt="Interface Assignments"><figcaption></figcaption></figure> |
| 29 | + |
| 30 | +5. Select the newly create interface by clicking on its name (in this example _[ParisOfficeVPN]_). |
| 31 | +6. Select **Enable Interface** |
| 32 | +7. Select **Prevent interface removal** |
| 33 | +8. Click **Save**, and then **Apply changes** |
| 34 | + |
| 35 | +### Create an outbound NAT rule |
| 36 | + |
| 37 | +1. Go to **Firewall → NAT → Outbound** |
| 38 | +2. Make sure the selected **Mode** is **Hybrid outbound NAT rule generation**; if it wasn't selected, click **Save** and then **Apply changes** |
| 39 | +3. Under **Manual rules**, add a new rule by clicking **+**. |
| 40 | +4. Select **Interface** – this should be either WAN or LAN, depending on the needs. |
| 41 | +5. Select **TCP/IP version** – either IPv4 or IPv6. |
| 42 | +6. Select **Source address** – this should be interface name assigned above plus _net_, e.g. _ParisOfficeVPN net_. |
| 43 | +7. Click **Save**, and then **Apply changes** |
| 44 | + |
| 45 | +<figure><img src="../../../.gitbook/assets/OPNSense-outbound-nat-rule.png" alt="Outbound NAT rule"><figcaption></figcaption></figure> |
| 46 | + |
| 47 | +### Add firewall rules to allow WireGuard traffic in |
| 48 | + |
| 49 | +1. Go to **Firewall → Rules → WAN** |
| 50 | +2. Click **+** (plus) to add a new rule |
| 51 | +3. The rule should _Pass_ the traffic _in_ with _quick_ option enabled |
| 52 | +4. Select **WAN** interface |
| 53 | +5. Choose **TCP/IP version** of your desire |
| 54 | +6. Select **UDP** protocol. |
| 55 | +7. Set **Destination** to **WAN address** and port to the port number provided in Defaurd Core: _Location configuration → Gateway port_ |
| 56 | +8. Click **Save**, and then **Apply changes** |
| 57 | + |
| 58 | +<figure><img src="../../../.gitbook/assets/OPNSense-firewall-rule.png" alt="Firewall rule"><figcaption></figcaption></figure> |
0 commit comments