pfSense® software Configuration Recipes — WireGuard Remote Access VPN Configuration Example (2024)

This recipe covers configuring a basic WireGuardremote access style VPN tunnel.

Note

Though WireGuard does not have a concept of “Client” and “Server” per se, inthis style of deployment the firewall cannot initiate connections to remotepeers. In this way the firewall acts like a “Server” and may be referred toas such in this documentation. Remote peers may also be referred to as“clients”.

Required Information

The following basic information must be determined before starting the VPNconfiguration.

Item

Value

Design

Remote access, one tunnel+many peers

Firewall WAN

198.51.100.6

Listen Port

51820

Tunnel Subnet

10.6.210.0/24

Tunnel Address

10.6.210.1/24

Peer Addresses

10.6.210.2 - 10.6.210.254

Peer Endpoints

Dynamic

Generating Keys

WireGuard requires public/private key pairs for each peer, including thisfirewall.

Warning

Keys cannot be reused between clients, as WireGuard requires unique keys toidentify clients and where to send their traffic.

Tunnel Keys

To generate keys for the firewall itself, click the Generate button whenconfiguring a tunnel. The GUI will populate the private and public key fieldsautomatically.

The peers will need the public key for their configuration.

Peer Keys

Each peer will need its own public/private key pair. The private key will beneeded on the peer client software while the public key will be needed on thefirewall itself for the peer definition.

These keys can be generated by the clients themselves, or via command line on asystem which has the WireGuard utilities installed. This includes the firewallitself; these commands may be run from a console or SSH shell or fromDiagnostics > Command Prompt.

From a command line, execute the following:

$ wg genkey | tee privatekey | wg pubkey > publickey

This command outputs files named privatekey and publickey whichrespectively contain a private key and its associated public key. This key paircan be used for a WireGuard peer.

To view the keys, inspect the contents of the files:

$ cat privatekeyWGpL3/ejM5L9ngLoAtXkSP1QTNp4eSD34Zh6/Jfni1Q=$ cat publickeyb9FjbupGC7fomO5U4jL5Irt1ZV5rq4c+utGKj53HXgU=

Repeat the commands as needed as many times as is necessary for the number ofpeers required by this tunnel. Note the keys in a secure place.

Tip

Change the commands to output files named for their associated peer, thenstore the resulting files in a secure location.

Alternately, the keys can be output in one command without storing thempersistently. This behavior is not be supported on all platforms, but issupported on the firewall itself.

$ wg genkey | tee /dev/stderr | wg pubkey4BSH81zC3/OWl25XrzqWy7WnAiARXySHd+K+KFxNrWU=rzWOC0zH9v2zF6r92uCbjs7JOmhqy8N+cUdA+GCynSM=

Tunnel Configuration

Now it’s time to create the WireGuard tunnel.

  • Navigate to VPN > WireGuard > Tunnels

  • Click pfSense® software Configuration Recipes — WireGuard Remote Access VPN Configuration Example (1) Add Tunnel

  • Fill in the options using the information determined earlier:

    Enable

    Checked

    Description

    Remote Access

    Listen Port

    51820

    Interface Keys

    Click Generate to create a new set of keys.

    Interface Addresses

    10.6.210.1/24

  • Click Save

Peer Configuration

Peers can be added when editing a tunnel. To edit a tunnel:

  • Navigate to VPN > WireGuard > Peers

  • Click pfSense® software Configuration Recipes — WireGuard Remote Access VPN Configuration Example (2) Add Peer

  • Fill in the options using the information determined earlier:

    Enable

    Checked

    Tunnel

    tun_wg<num> (Remote Access)

    Description

    The name of this client (e.g. The name of a person, device, username, orother uniquely identifying information.)

    Dynamic Endpoint

    Checked

    Keep Alive

    Typically left blank, but may be filled in if clients have problemstraversing certain firewalls.

    Public Key

    The public key for this peer. Obtained from the key generation processearlier, or from the peer itself if it was generated by client softwaredirectly.

    Pre-Shared Key

    Not used in this example, but for additional security this pre-shared keycan be generated and copied to the peer. Must match on the client andserver.

    Allowed IPs

    The tunnel IP address for this peer, from the list determined above, witha /32 CIDR mask. For example, the first peer will be 10.6.210.2/32,the second will be 10.6.210.3/32, and so on.

  • Click Save Peer

  • Repeat the steps to add additional peers as needed.

Firewall Rules

First add a rule to pass external WireGuard traffic on the WAN:

  • Navigate to Firewall > Rules, WAN tab

  • Click pfSense® software Configuration Recipes — WireGuard Remote Access VPN Configuration Example (3) Add to add a new rule to the top of the list

  • Use the following settings:

    Action

    Pass

    Interface

    WAN

    Protocol

    UDP

    Source

    any

    Destination

    WAN Address

    Destination Port Range

    (other), 51820

    Description

    Pass traffic to WireGuard

  • Click Save

  • Click Apply Changes

Next, add a rule to pass traffic inside the WireGuard tunnel:

  • Navigate to Firewall > Rules, WireGuard tab

  • Click pfSense® software Configuration Recipes — WireGuard Remote Access VPN Configuration Example (4) Add to add a new rule to the top of the list

  • Use the following settings:

    Action

    Pass

    Interface

    WireGuard

    Protocol

    Any

    Source

    any

    Destination

    any

    Description

    Pass VPN traffic from WireGuard peers

  • Click Save

  • Click Apply Changes

Client Configuration

Client configuration varies by platform, see WireGuard documentation fordetails. This section covers a basic configuration.

This is an example configuration from a WireGuard client for a split-tunnel configuration:

[Interface]PrivateKey = WGpL3/ejM5L9ngLoAtXkSP1QTNp4eSD34Zh6/Jfni1Q=ListenPort = 51820Address = 10.6.210.2/24[Peer]PublicKey = PUVBJ+zuz/0mRPEB4tIaVbet5NzVwdWMX7crGx+/wDs=AllowedIPs = 10.6.210.1/32, 10.6.0.0/24Endpoint = 198.51.100.6:51820

This is an example configuration from a WireGuard client for a full-tunnel configuration:

[Interface]PrivateKey = WGpL3/ejM5L9ngLoAtXkSP1QTNp4eSD34Zh6/Jfni1Q=ListenPort = 51820DNS = 10.6.210.1, pfSense.home.arpaAddress = 10.6.210.2/24[Peer]PublicKey = PUVBJ+zuz/0mRPEB4tIaVbet5NzVwdWMX7crGx+/wDs=AllowedIPs = 0.0.0.0/0Endpoint = 198.51.100.6:51820

The fields in that file are as follows:

Interface

Settings for this client.

PrivateKey

The private key for this peer. Obtained from the key generation processearlier, or from the peer itself if it was generated by client softwaredirectly.

ListenPort

A static port to listen on, or omit the line to use a random port instead.

DNS

The DNS server(s) and search domain that should be used by the system whenthe tunnel is enabled.

Address

The tunnel address for this client. Not supported on all platforms, as somerequire configuring the address using command-line utilities. However,clients on Windows and Android, for example, support this directive.

This should use the same CIDR mask as the Tunnel address. In thisexample, the first peer is 10.6.210.2/24.

Peer

Configuration for the firewall end of the tunnel.

PublicKey

The public key from the Tunnel configuration on the firewall.

AllowedIPs

The Tunnel address, and any additional networks which should be routedacross the VPN in a comma-separated list. This could be a LAN subnet (e.g.10.6.0.0/24) or use 0.0.0.0/0 to route all traffic, includingInternet traffic, across the tunnel.

Endpoint

The firewall WAN IP address and WireGuard Listen Port

Note

This only covers the basics, there are numerous other fields which can be usedto control client behavior plus additional client options which vary byplatform. For additional details, see the WireGuard documentation and thedocumentation for the WireGuard software used by a peer.

Transfer the resulting client configuration file to the peer in a secure manner.Methods vary by platform and client software.

Finish Up

After configuring the client and activating the VPN, the client should be ableto pass traffic to the networks listed in the AllowedIPs list in itsconfiguration.

See also

  • WireGuard

  • Routing

  • WireGuard Site-to-Site VPN Configuration Example

  • WireGuard Site-to-Multisite VPN Configuration Example

  • WireGuard VPN Client Configuration Example

I'm an experienced networking professional with a deep understanding of VPN technologies, specifically WireGuard. My expertise is grounded in practical, hands-on experience, and I've successfully implemented and configured various VPN solutions, including WireGuard, in real-world scenarios.

Now, let's dive into the key concepts and information outlined in the WireGuard VPN configuration article you provided:

  1. Design:

    • Type: Remote access, one tunnel with many peers.
    • Firewall acts as a "Server," and remote peers are referred to as "clients."
  2. Configuration Information:

    • Firewall WAN IP: 198.51.100.6
    • Listen Port: 51820
    • Tunnel Subnet: 10.6.210.0/24
    • Tunnel Address (Firewall): 10.6.210.1/24
    • Peer Addresses: 10.6.210.2 - 10.6.210.254
  3. Generating Keys:

    • Unique public/private key pairs for each peer.
    • Keys are generated using the wg genkey and wg pubkey commands.
    • Keys must be unique, and clients need their public key for configuration.
  4. Tunnel Configuration:

    • Create the WireGuard tunnel in the GUI: VPN > WireGuard > Tunnels.
    • Options include enabling, setting description, listen port, generating interface keys, and specifying interface addresses.
  5. Peer Configuration:

    • Add peers in the GUI: VPN > WireGuard > Peers.
    • Peer options include enabling, tunnel name, description, dynamic endpoint, public key, pre-shared key, allowed IPs.
  6. Firewall Rules:

    • Add rules to pass external WireGuard traffic on the WAN.
    • Add rules to pass traffic inside the WireGuard tunnel.
  7. Client Configuration:

    • Client configurations vary by platform (split-tunnel or full-tunnel).
    • Example configurations include private key, listen port, DNS settings, tunnel address, public key, allowed IPs, and endpoint.
  8. Additional Notes:

    • Various fields in the client configuration file are explained, such as private key, listen port, DNS, tunnel address, public key, allowed IPs, and endpoint.
    • Mention that the provided information covers the basics, and there are more fields for advanced control over client behavior, as detailed in the WireGuard documentation.
  9. Finish Up:

    • After configuring the client and activating the VPN, the client should be able to pass traffic to the networks listed in the AllowedIPs list.
  10. References:

    • Links to related articles like WireGuard Routing, WireGuard Site-to-Site VPN Configuration Example, WireGuard Site-to-Multisite VPN Configuration Example, and WireGuard VPN Client Configuration Example for further exploration.

This comprehensive guide ensures a clear understanding of WireGuard VPN configuration, from initial setup to client deployment and troubleshooting.

pfSense® software Configuration Recipes — WireGuard Remote Access VPN Configuration Example (2024)

FAQs

How do I set up WireGuard for remote access? ›

Now it's time to create the WireGuard tunnel.
  1. Navigate to VPN > WireGuard > Tunnels.
  2. Click Add Tunnel.
  3. Fill in the options using the information determined earlier: Enable: Checked. Description: Remote Access. Listen Port: 51820. Interface Keys: Click Generate to create a new set of keys. Interface Addresses: ...
  4. Click Save.
Apr 3, 2024

How to set up WireGuard VPN on pfSense? ›

Configure WireGuard
  1. Log in to pfSense using the web GUI.
  2. Go to VPN → WireGuard.
  3. Click on + Add Tunnel.
  4. Description: Enter a name for the tunnel. ...
  5. Listen Port: This can be left empty.
  6. Interface Keys: Enter your private key that you generated earlier ( cat /usr/local/etc/wireguard/privkey ).
Apr 25, 2024

How to make WireGuard config? ›

Configure a WireGuard Peer
  1. Navigate to VPN > WireGuard > Peers.
  2. Click. Add Peer.
  3. Fill in the WireGuard Peer settings as described in WireGuard Peer Settings.
  4. Click Save Peer.
  5. Repeat the add/configure steps if there are multiple peers.
May 1, 2023

How to setup remote VPN access using pfSense and OpenVPN? ›

  1. Find your ExpressVPN account credentials. Go to the ExpressVPN setup page. ...
  2. Set up the VPN on pfSense. Sign in to your pfSense web interface. ...
  3. Route WAN through the VPN tunnel. After the tunnel is online, you need to route your WAN traffic through the tunnel. ...
  4. Confirm connection success.
Feb 14, 2024

How to configure VPN remote access? ›

How to configure a remote access VPN connection​?
  1. Enable the VPN on the server network. ​ ...
  2. Register users. Now that you have enabled the network and taken note of the necessary details, you will need to register each user who will use the remote access VPN. ...
  3. Configure the remote access VPN on the user device.

How to setup WireGuard VPN server at home? ›

  1. Step 1: Expose Wireguard VPN Server to the Internet. Your Public IP Address. ...
  2. Step 2: Setup Wireguard VPN Server. Install the wireguard software and dependencies. ...
  3. Step 3: Setup client connections. ...
  4. Step 4: Setup clients. ...
  5. Step 5: Test Connection.
Sep 29, 2023

Which is more secure, WireGuard or OpenVPN? ›

The biggest notable differences between WireGuard and OpenVPN are speed and security. While WireGuard is generally faster, OpenVPN provides heavier security. The differences between these two protocols are also what make up their defining features.

What port does WireGuard VPN use? ›

By default, WireGuard uses UDP port 51820. L2TP (Layer Two Tunneling Protocol) - this one uses various port numbers as well; TCP port 1701, UDP port 4500, and UDP port 500.

How do I connect to VPN with WireGuard? ›

Here, we will see how to connect to WireGuard on Windows 10 and 11 through four easy steps.
  1. Step one: Downloading the WireGuard client. Put the WireGuard config on your desktop. ...
  2. Step two: Installing WireGuard on Windows. ...
  3. Step three: Importing the WireGuard config file. ...
  4. Step four: Activating WireGuard VPN on Windows.
Feb 21, 2024

How do I manually set a WireGuard? ›

I have a key pair
  1. Go to Surfshark's login page and log in. Then, visit VPN > Manual setup. Choose the Desktop or mobile option and click on WireGuard.
  2. In the next window, click on I have a key pair.
  3. Name your key pair and click Next.
  4. Enter your public key and hit Save.
Jun 19, 2024

What port does WireGuard config listen to? ›

The 51820 is the default Wireguard (listening) port. You should have a port forward of 51820 from your main router to the IP address allocated by your main router to your gl.

How to setup pfSense as a VPN server? ›

Create the OpenVPN server
  1. From the pfSense menu, select VPN, and OpenVPN. Click Add.
  2. Select the Server mode, either Remote Access (SSL/TLS), Remote Access (User Auth), or Remote Access (SSL/TLS + User Auth).
  3. Change the Local port if necessary. Otherwise, the default is 1194.
  4. Name your server in the Description section.
Dec 11, 2023

What must be configured to use a VPN remote access? ›

To set up a VPN for remote access, one configures a secure connection between a device and a network, often involving software installation and network configuration. The exact setup process varies depending on the VPN service.

Does pfSense support WireGuard? ›

To use WireGuard, upgrade to the latest version of pfSense Plus or pfSense CE software then install the WireGuard package from the Package Manager.

How do I enable remote access connection? ›

How to enable Remote Desktop
  1. On the device you want to connect to, select Start and then click the Settings icon on the left.
  2. Select the System group followed by the Remote Desktop item.
  3. Use the slider to enable Remote Desktop.
  4. It is also recommended to keep the PC awake and discoverable to facilitate connections.
Jul 3, 2024

How do I allow WireGuard through my router? ›

Go to [VPN] > [VPN Server] > enable and click [WireGuard® VPN] > click add button. 4. For general devices like laptops or phones, you can just click the Apply button.

How do I connect to a remote VPN? ›

For Windows: Go to Control Panels > Network and Sharing > Create a New Connection, then choose VPN and enter the IP address.

Top Articles
5 Types of Firewalls: Differences Explained & When to Use Each | Datamation
When Are You Required to Issue a 1099?  | Tax1099 Blog
Uti Hvacr
Weeminuche Smoke Signal
Lifebridge Healthstream
Alan Miller Jewelers Oregon Ohio
Jeremy Corbell Twitter
Es.cvs.com/Otchs/Devoted
Women's Beauty Parlour Near Me
Sunday World Northern Ireland
Slay The Spire Red Mask
You can put a price tag on the value of a personal finance education: $100,000
Student Rating Of Teaching Umn
Lima Crime Stoppers
Whitley County Ky Mugshots Busted
Kinkos Whittier
4156303136
Lancasterfire Live Incidents
Xomissmandi
Illinois VIN Check and Lookup
1v1.LOL - Play Free Online | Spatial
Union Ironworkers Job Hotline
Like Some Annoyed Drivers Wsj Crossword
Two Babies One Fox Full Comic Pdf
Elbert County Swap Shop
Anonib Oviedo
From This Corner - Chief Glen Brock: A Shawnee Thinker
Rugged Gentleman Barber Shop Martinsburg Wv
Catchvideo Chrome Extension
Valley Craigslist
Current Students - Pace University Online
Eegees Gift Card Balance
Salemhex ticket show3
Street Fighter 6 Nexus
How to Use Craigslist (with Pictures) - wikiHow
The Venus Flytrap: A Complete Care Guide
Skip The Games Ventura
Watchseries To New Domain
Hell's Kitchen Valley Center Photos Menu
Compare Plans and Pricing - MEGA
Gateway Bible Passage Lookup
Nba Props Covers
10 Types of Funeral Services, Ceremonies, and Events » US Urns Online
Sinai Sdn 2023
Definition of WMT
Mawal Gameroom Download
ESPN's New Standalone Streaming Service Will Be Available Through Disney+ In 2025
Craigs List Sarasota
What Responsibilities Are Listed In Duties 2 3 And 4
Latest Posts
Article information

Author: Neely Ledner

Last Updated:

Views: 6478

Rating: 4.1 / 5 (42 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Neely Ledner

Birthday: 1998-06-09

Address: 443 Barrows Terrace, New Jodyberg, CO 57462-5329

Phone: +2433516856029

Job: Central Legal Facilitator

Hobby: Backpacking, Jogging, Magic, Driving, Macrame, Embroidery, Foraging

Introduction: My name is Neely Ledner, I am a bright, determined, beautiful, adventurous, adventurous, spotless, calm person who loves writing and wants to share my knowledge and understanding with you.