To implement multiple WireGuard VPNs within pfSense, follow these detailed steps:


1. Preparation

Before setting up multiple WireGuard VPNs, ensure your pfSense environment is clean and ready for configuration:

  • Remove unused gateways, static routes, and gateway groups.
  • Delete unused interface assignments.
  • Clear out unused firewall rules and NAT rules (especially outbound NAT rules).
  • Set Outbound NAT Mode to Manual Outbound NAT rule generation. This ensures traffic routing through the intended VPN tunnels without leaks. Navigate to Firewall > NAT > Outbound to verify this setting.

2. Install the WireGuard Package

  1. Go to System > Package Manager > Available Packages.
  2. Search for "WireGuard" and click Install.
  3. Confirm the installation when prompted.

3. Configure the First WireGuard Tunnel

Add a Tunnel:

  1. Navigate to VPN > WireGuard > Tunnels and click + Add Tunnel.
  2. Tick Enable Tunnel.
  3. Provide a description (e.g., Wireguard_VPN_1).
  4. Leave the Listen Port empty (defaults will be used).
  5. Click Generate next to Interface Keys to create public/private key pairs.
  6. Save the tunnel configuration by clicking Save Tunnel, then click Apply Changes.

Generate Configuration with Your VPN Provider:

  1. Log in to your VPN provider's portal and generate a WireGuard configuration file for your first tunnel.
    • Provide your public key (generated in Step 3 above) if required by the provider.
    • Obtain details such as endpoint IP, port, allowed IPs, and DNS servers from the provider.

Add Peer Information:

  1. Navigate back to VPN > WireGuard > Tunnels, locate your newly created tunnel, and click on it to edit.
  2. Scroll down to add a peer:
    • Description: e.g., Peer_1.
    • Endpoint: Enter the server IP address provided by your VPN provider.
    • Endpoint Port: Use the port specified by your provider (e.g., 51820).
    • Public Key: Paste the public key of your VPN provider’s server from their configuration file.
    • Allowed IPs: Use 0.0.0.0/0 unless otherwise specified by your provider for routing all traffic through this tunnel.
  1. Save changes and apply them.

4. Assign an Interface for Each Tunnel

For each WireGuard tunnel you configure:

  1. Navigate to Interfaces > Assignments.
  2. Select the appropriate tun_wgX interface from the dropdown menu under "Available network ports."
  3. Click Add, which creates an OPT interface (e.g., OPT1).
  4. Edit this new interface:
    • Enable it by ticking "Enable Interface."
    • Provide a description such as WG_Tunnel_1.
    • Set IPv4 Configuration Type to "Static IPv4."
    • Enter an IPv4 address matching what was assigned in your VPN provider’s configuration file (e.g., 10.x.x.x/32).
  1. Save changes and apply them.

Repeat this process for each additional WireGuard tunnel you want to configure.


5. Configure Outbound NAT Rules

To ensure proper routing of traffic through each respective tunnel:

  1. Navigate to Firewall > NAT > Outbound.
  2. For each local subnet that should use a specific WireGuard tunnel:
    • Add a new rule at the top of the list with these settings:
      • Interface: Select the corresponding WireGuard interface (e.g., WG_Tunnel_1).
      • Source: Specify your LAN subnet or other internal subnets that should route through this tunnel.
      • Translation Address: Select "Interface Address."
  1. Disable any conflicting outbound NAT rules related to WAN interfaces or other tunnels if necessary.
  1. Save changes and apply them.

6. Firewall Rules for Traffic Routing

To control which traffic uses which tunnel:

  1. Navigate to Firewall > Rules, then select your LAN tab or another relevant interface tab where traffic originates.
  2. Create pass rules with these settings:
    • Action: Pass
    • Protocol: Any
    • Source: Your LAN subnet(s) or specific devices/IP ranges as needed.
    • Gateway: Choose the gateway associated with each specific WireGuard tunnel (created automatically during setup).
  1. Apply changes after saving each rule.

Repeat this process for all tunnels you’ve configured.


7. Static Routes for Multiple Tunnels

If you have multiple tunnels connected simultaneously, define static routes so that traffic destined for specific networks uses their respective tunnels:

  1. Go to System > Routing > Static Routes.
  2. Add routes specifying destination networks that should use particular gateways tied to individual tunnels.

For example:

  • Destination Network: The remote network accessible via Tunnel 1 (e.g., 192.x.x.x/24).
  • Gateway: The gateway associated with Tunnel 1 (WG_Tunnel_1_GW).

Repeat this step for all additional tunnels as needed.


8 Optional Steps

Kill Switch Configuration:

To prevent data leaks if a VPN connection drops unexpectedly, set up kill switch rules under Firewall > Rules > Floating Rules:

  • Block all outgoing traffic on WAN unless explicitly allowed via a VPN gateway rule.

DNS Configuration Per Tunnel:

Ensure DNS queries are routed through their respective tunnels by configuring DNS servers provided by each VPN service under System > General Setup, assigning them per gateway tied to individual tunnels.


Verification of Setup

After completing all configurations, verify functionality using these steps:

Check Public IP Address:

Run commands like curl ifconfig.me or visit websites like IP Chicken from devices routed through each tunnel to confirm they show different public IP addresses corresponding to their respective endpoints.[2]

Test Connectivity Between Tunnels (if applicable):

Use ping or traceroute tools between devices routed through different tunnels or subnets defined in static routes.[3]


By following these steps methodically, you can successfully implement multiple WireGuard VPNs within pfSense while maintaining proper routing and security configurations tailored per connection requirement.[1] [2] [3]


Authoritative Sources

  1. [Guide] Setup a wireguard tunnel to VPN provider [Netgate Forum]
  2. Comparitech Guide on pfSense & Wireguard [Comparitech]
  3. Netgate Documentation on Site-to-Multisite Configurations [Netgate Docs]

Answer Provided by www.iAsk.ai – Ask AI.

Sign up for free to save this answer and access it later

Sign up →

Web Results

problem with multiple wireguard instances on pfsense
https//airvpn.org › forums › topic › 58954-problem-with-multiple-wireguard-instances-on-pfsense
problem with multiple wireguard instances on pfsense
Is it possible to install multiple wireguard connections from my pfsense to airvpn? If i get the config from airvpn i get every time the ...
Site to site pfsense with wireguard - Networking & Firewalls
https//forums.lawrencesystems.com › t › site-to-site-pfsense-with-wireguard › 13972
Site to site pfsense with wireguard - Networking & Firewalls
Have you also read up on Netgate's documentation? They do provide a good WireGuard Site-to-Site VPN Configuration Example in their documentation ...
Wireguard Multiple tunnel setup : r/PFSENSE
https//www.reddit.com › r › PFSENSE › comments › s8ocwf › wireguard_multiple_tunnel_setup
Wireguard Multiple tunnel setup : r/PFSENSE
I have one wireguard tunnel setup and working just fine on pfSense. I'd like to setup another tunnel to a different endpoint for another device on the network.
PFsense: Wireguard tunnel inside another tunnel
https//forum.level1techs.com › t › pfsense-wireguard-tunnel-inside-another-tunnel › 206062
PFsense: Wireguard tunnel inside another tunnel
Verify two pfSense routers can ping each other using their private static IPs they got from mullvad. Make another wireguard interface on each ...