In this article, we'll walk you through the steps to connect your pfSense firewall to a vpnsafe.net WireGuard VPN. WireGuard is a modern, secure, and high-performance VPN protocol that is increasingly popular due to its simplicity and speed.
Prerequisites
- A pfSense firewall running version 2.5.0 or later.
- A valid account with vpnsafe.net.
- WireGuard package installed on your pfSense device.
Step 1: Install the WireGuard Package on pfSense
-
Log in to pfSense:
- Open your web browser and log in to your pfSense firewall.
-
Navigate to Package Manager:
- Go to
System
>Package Manager
.
- Go to
-
Install WireGuard:
- Click on the
Available Packages
tab. - Search for
WireGuard
. - Click
Install
next to the WireGuard package. - Confirm and wait for the installation to complete.
- Click on the
Step 2: Obtain WireGuard Configuration from vpnsafe.net
-
Log in to vpnsafe.net:
- Access your account on the vpnsafe.net website.
-
Generate WireGuard Configuration:
- Navigate to the VPN configuration section.
- Select
WireGuard
as the VPN type. - Download the configuration file or note down the necessary details (Public Key, Private Key, Endpoint, Allowed IPs, and DNS).
Step 3: Configure WireGuard on pfSense
-
Access WireGuard Settings:
- Go to
VPN
>WireGuard
.
- Go to
-
Add a New Tunnel:
- Click on the
+ Add Tunnel
button.
- Click on the
-
Configure the Tunnel:
- Description: Name the tunnel (e.g.,
vpnsafe.net WireGuard
). - Public Key: Use the Public Key provided by vpnsafe.net.
- Private Key: Use the Private Key provided by vpnsafe.net.
- Listen Port: Leave as default or specify a port if required.
- Description: Name the tunnel (e.g.,
-
Save and Apply:
- Click
Save
. - Apply changes if prompted.
- Click
Step 4: Add Peers to the Tunnel
-
Add a Peer:
- Click on the
+ Add Peer
button within the WireGuard tunnel configuration.
- Click on the
-
Configure the Peer:
- Description: Name the peer (e.g.,
vpnsafe.net Server
). - Endpoint: Enter the endpoint provided by vpnsafe.net (e.g.,
vpn.vpnsafe.net:51820
). - Public Key: Enter the public key of the vpnsafe.net server.
- Allowed IPs: Enter
0.0.0.0/0
to route all traffic through the VPN. - DNS Servers: Enter the DNS server IPs provided by vpnsafe.net if applicable.
- Description: Name the peer (e.g.,
-
Save and Apply:
- Click
Save
. - Apply changes if prompted.
- Click
Step 5: Configure Firewall Rules
-
Add Interface:
- Go to
Interfaces
>Assignments
. - You should see a new interface named
wg0
(or similar). Click+
to add it. - Name the interface (e.g.,
VPN_WG
). - Enable the interface and click
Save
.
- Go to
-
Configure Interface:
- Click on the newly added interface.
- Set
IPv4 Configuration Type
toNone
. - Click
Save
and thenApply Changes
.
-
Create Firewall Rules:
- Go to
Firewall
>Rules
. - Select the newly created interface tab (e.g.,
VPN_WG
). - Click
+ Add
to create a new rule.- Action: Pass
- Interface:
VPN_WG
- Address Family: IPv4
- Protocol: Any
- Click
Save
andApply Changes
.
- Go to
Step 6: Route Traffic Through the VPN
-
Go to System > Routing:
- Click on the
Gateways
tab. - Add a new gateway if it does not exist for
wg0
.
- Click on the
-
Set Default Gateway:
- Go to the
System
>Routing
>Gateways
tab. - Edit your WAN_DHCP or equivalent.
- Set the new WireGuard gateway as the default gateway.
- Go to the
Step 7: Test the VPN Connection
-
Check Status:
- Go to
Status
>WireGuard
. - Ensure the tunnel is active and the peer is connected.
- Go to
-
Verify Connection:
- Use an external service like
whatismyip.com
to confirm your public IP matches the VPN server.
- Use an external service like
Conclusion
By following these steps, you should have successfully connected your pfSense firewall to a vpnsafe.net WireGuard VPN. This setup enhances your network security and ensures your traffic is routed securely through the VPN.
If you encounter any issues, refer to the vpnsafe.net support or the pfSense documentation for additional troubleshooting tips.