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.

Tunnel Configuration

Now it’s time to create the WireGuard tunnel.

  • Navigate to VPN > WireGuard > Tunnels

  • Click 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 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 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 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

WireGuard Remote Access VPN Configuration Example (2024)

FAQs

How to setup WireGuard for remote access? ›

Create the Wireguard Setup on your Internal Network
  1. Enter a unique Name for this Interface.
  2. Enter a Description (optional)
  3. Check Enabled.
  4. Enter the IP Address to be used for this Wireguard Internal Network. ...
  5. Enter the Listen Port to be used when connecting to the VPN (Default: 51820).

How to setup VPN on WireGuard? ›

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 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 configure site to site WireGuard VPN? ›

First create the WireGuard tunnel on both sites:
  1. Navigate to VPN > WireGuard > Tunnels.
  2. Click Add Tunnel.
  3. Fill in the options using the information determined earlier, with variations noted for each site: Enabled: Checked. HQ Settings: Description: ...
  4. Copy the public key from each firewall and note which is which.
  5. Click Save.
Apr 3, 2024

What is the difference between tunnel and peer in WireGuard? ›

In Wireguard, a Tunnel is the same as a "Server" in OpenVPN - except all devices need one, so it can also mean a networking server running on localhost. 1b. In Wireguard, a Peer is the same as a "Client" in OpenVPN.

How does VPN allow remote access? ›

A secure remote access VPN creates a tunnel between the network and a remote user that is virtually private. Traffic is encrypted, which makes it unintelligible to eavesdroppers. Users in remote locations can securely access and use the network in much the same way as in the office.

How do I set up my VPN configuration? ›

Create a VPN profile
  1. Select Start > Settings > Network & internet > VPN > Add VPN.
  2. Under Add a VPN connection, do the following: For VPN provider, choose Windows (built-in). In the Connection name box, enter a name you'll recognize (for example, My Personal VPN). ...
  3. Select Save.

What is the difference between VPN and remote access VPN? ›

A Remote Access VPN is tailored for individual user access, providing a secure gateway for remote users to connect to a private network from diverse locations. On the other hand, a Site-to-Site VPN focuses on connecting entire networks situated in different locations.

How do I set up remote access to my network? ›

On your Windows, Android, or iOS device: Open the Remote Desktop app (available for free from Microsoft Store, Google Play, and the Mac App Store), and add the name of the PC that you want to connect to (from Step 1). Select the remote PC name that you added, and then wait for the connection to complete.

Where do I put the config file for WireGuard? ›

We are then set to start configuring the WireGuard server. The config files are generally stored in the /etc/wireguard folder. Create a new configuration file called wg0. conf in that folder.

Which is better site to site VPN 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 their defining features. We've taken a closer look at each so you can really understand how they work.

Is WireGuard more secure than IPSec? ›

Compared to IPSec, WireGuard is thought to provide faster performance and more security because of its smaller codebase. On the other hand, IPSec is a well-developed protocol with a wealth of features and compatibility.

How to access home network remotely VPN? ›

Setting Up VPN Tunnel to Home Network
  1. Choose a VPN Service Provider. ...
  2. Configure VPN Server on Home Router or Server. ...
  3. Enable Port Forwarding (If Necessary) ...
  4. Generate VPN Configuration Files or Credentials. ...
  5. Install VPN Client on Remote Devices. ...
  6. Configure VPN Client Settings. ...
  7. Establish VPN Tunnel Connection. ...
  8. Test Remote Access.
Mar 20, 2024

How do I use open VPN for remote access? ›

Navigate to the OpenVPN Connect folder by entering cd %ProgramFiles%/OpenVPN Connect . Install the system service with the command: ovpnconnector.exe install . Add Remote Access Role and Features to Windows Server application. Configure LAN routing on their server.

Is WireGuard better than OpenVPN? ›

WireGuard is faster than OpenVPN in terms of speed, but OpenVPN may be better than WireGuard in terms of security. Since WireGuard is still a relatively new protocol, only time will tell if its paired-down code and UDP transport layer will withstand the security provided by OpenVPN's bulky code and SSL transport.

How do I manually set a WireGuard? ›

How to manually configure WireGuard on Windows
  1. Download and install the official WireGuard VPN client.
  2. Sign in to account.protonvpn.com, go to Downloads → WireGuard configuration, and download a WireGuard configuration file. ...
  3. Open the official WireGuard VPN client and click Import Tunnel(s) from File.

Top Articles
how do i recover my browsing history ?
Gas vs Charcoal Grills | Advantages & Disadvantages
Craigslist Myrtle Beach Motorcycles For Sale By Owner
Nullreferenceexception 7 Days To Die
Pga Scores Cbs
Cad Calls Meriden Ct
La connexion à Mon Compte
How to change your Android phone's default Google account
Us 25 Yard Sale Map
The Realcaca Girl Leaked
35105N Sap 5 50 W Nit
Craigslist Dog Sitter
Paula Deen Italian Cream Cake
Produzione mondiale di vino
Catsweb Tx State
Maxpreps Field Hockey
Herbalism Guide Tbc
Cool Math Games Bucketball
Puretalkusa.com/Amac
Charter Spectrum Store
Air Force Chief Results
Ruse For Crashing Family Reunions Crossword
Little Caesars 92Nd And Pecos
BMW K1600GT (2017-on) Review | Speed, Specs & Prices
12 Top-Rated Things to Do in Muskegon, MI
Directions To Nearest T Mobile Store
Deshuesadero El Pulpo
Cognitive Science Cornell
Lacey Costco Gas Price
'Insidious: The Red Door': Release Date, Cast, Trailer, and What to Expect
Rgb Bird Flop
Little Einsteins Transcript
Autopsy, Grave Rating, and Corpse Guide in Graveyard Keeper
Pokemmo Level Caps
Worlds Hardest Game Tyrone
Frostbite Blaster
Metro 72 Hour Extension 2022
Wsbtv Fish And Game Report
Bitchinbubba Face
Eastern New Mexico News Obituaries
RECAP: Resilient Football rallies to claim rollercoaster 24-21 victory over Clarion - Shippensburg University Athletics
Arigreyfr
Tinfoil Unable To Start Software 2022
Cabarrus County School Calendar 2024
Hk Jockey Club Result
Lorton Transfer Station
9294027542
60 Days From August 16
Blippi Park Carlsbad
Craigslist Anc Ak
Jigidi Jigsaw Puzzles Free
Unit 4 + 2 - Concrete and Clay: The Complete Recordings 1964-1969 - Album Review
Latest Posts
Article information

Author: Virgilio Hermann JD

Last Updated:

Views: 5476

Rating: 4 / 5 (41 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Virgilio Hermann JD

Birthday: 1997-12-21

Address: 6946 Schoen Cove, Sipesshire, MO 55944

Phone: +3763365785260

Job: Accounting Engineer

Hobby: Web surfing, Rafting, Dowsing, Stand-up comedy, Ghost hunting, Swimming, Amateur radio

Introduction: My name is Virgilio Hermann JD, I am a fine, gifted, beautiful, encouraging, kind, talented, zealous person who loves writing and wants to share my knowledge and understanding with you.