WireGuard: The Next-Gen VPN Protocol (2024)

Introduction

The landscape of the Internet is an ever-changing ecosystem, and one of the current collective focal points of it are Virtual Private Networks or VPNs. One can’t help but notice the uptick in the number of advertisem*nts of VPN vendors. A relevant metric of this is the worldwide increase in the search of the term “VPN” in Google via Google Trends.

WireGuard: The Next-Gen VPN Protocol (1) Fig. 1: Google Trend Result for Keyword "VPN"

In Fig. 1, we can observe an upward trend in the graph for the search term “VPN” with respect to time since 2014. People worldwide have become increasingly aware about privacy and handling of their personal data on the Internet. There are many individual reasons that a users would choose to employ a VPN such as to bypass censorship firewalls in some countries.

VPN is a framework to use a private network connection on a public network. It makes it tough for any third-party to track the user’s device and private data. Even after Network Address Translation (NAT), an Internet layman’s IP Address has enough information to reveal their general location. You could try it yourself by going to this website. This is based on the public IP that your ISP provides, and not everyone is comfortable with sharing it out in the open while surfing the Internet.

The methodology employed by the VPN providers is to redirect the client’s traffic to a remote server that could be situated anywhere in the world. The VPN essentially hides the client’s IP behind a brand-new public IP and encrypt the traffic. Furthermore, each time the client connects to the VPN their public IP changes, anonymizing the browser activity.

There have been many tunneling protocols that help establish a VPN connection. Notable among them are IPsec and OpenVPN.

Enter WireGuard

WireGuard is both a communications protocol and an open-source software project that establishes a VPN connection. It is designed in a compact and secure way and has already been integrated to the Linux Kernel.

The inception of this protocol was borne out of a covert traffic tunneling solution that its creator was trying to implement. During his efforts, he realized that protocols like IPsec and OpenVPN operated on large and bulky codebases, which were harder to debug, manage, and set up properly.

That is why at the core of WireGuard’s philosophy are concepts of minimalism, security, and ease-of-use. An example of which can be seen in the size of its codebase itself, which stands at around 4000+ lines compared to 100,000+ lines of code that OpenVPN uses.

IMplementation

WireGuard is a layer 3 network tunnel protocol for IPv4 and IPv6. It runs over UDP in a connection-less way and uses modern cryptographic principles with an authentication style like SSH’s “authentication keys”. It emphasizes simplicity and a compact codebase that could be easily auditable by security researchers.

WireGuard uses modern cryptography paradigms such as Curve25519 for key exchange, BLAKE2s for hashing, and ChaCha20 and Poly1305 for authentication. Breaking through its security is not exactly a walk in the park.

In the WireGuard framework, a brand-new network interface (usually named wg0 by users) gets assigned to each device or peer in the network. The communication among peers is restricted to this interface only.

Features

We will now look at some of the interesting features of the WireGuard Protocol in depth.

CryptoKey Routing

For authentication among peers, WireGuard uses a concept it refers to as “CryptoKey Routing”. In this process a public and private keypair is generated and associated to each peer’s IP address. This IP address is allocated to the peer via the WireGuard interface. This interface also holds the information of the peers which are allowed to communicate with it in the form of the peer’s public key and tunnel IP.

The static public key and tunnel IP information can be distributed among the peers through any secure out-of-band methodology. Like how distribution of SSH keys work.

If any network packet arrives at the wg0 interface that does not have a source IP which is already allowed, it is rejected.

WireGuard: The Next-Gen VPN Protocol (2) Fig. 2: WireGuard Configuration file in the VPN Client

WireGuard: The Next-Gen VPN Protocol (3) Fig. 3: WireGuard Configuration file in the VPN Server

Stateless, While Stateful

WireGuard appears stateless to the user. The end user only needs to the configure it once, and that is enough for it to start and keep working. It is inherently stateful though, and the state management is taken care of by a set of internal timers.

For example,

- If a user needs to send a packet and no handshake has been established with a peer in the last 120 seconds, a new handshake gets initiated.

- If there is no response of that handshake for 5 seconds, another handshake is initiated.

- If after an established connection, no authenticated packets have arrived for 15 seconds, a handshake is initiated.

This is all done automatically, and the user does not have to keep track of it. Each transition of the state machine has been taken care of.

Key Exchange

WireGuard: The Next-Gen VPN Protocol (4) Fig. 4: Message Exchange in WireGuard

WireGuard uses the Noise_IK handshake provided by the Noise Protocol. This handshake is based around Diffie-Hellman Key Exchange.

In this process, a set of ephemeral Diffie-Hellman keypair are generated for each peer in each handshake. These peers would also have the static keypair, which has been shared previously.

The Diffie-Hellman calculations are done using the combination of these keypairs, to generate shared session keys which are used to encrypt and decrypt the communication on a particular session.

This key exchange is 1-RTT in nature, requires no certificate exchanges and is carried out by just exchanging a 32-bytes base64 encoded public key.

Message Types

WireGuard has the following packet message types:

- Handshake Initiation

- Handshake Response

- Transport Data Packet

- Cookie Reply Packet

Let us take a look individually:

A. Handshake Initiation

This is the first packet that the peer, referred to as the initiator sends. It holds a unique index associated with the initiator, an unencrypted Diffie-Hellman ephemeral public key and the encrypted static public key among other fields.

WireGuard: The Next-Gen VPN Protocol (5) Fig. 5: Handshake Initiation Packet in Wireshark

It also contains the MAC (Message Authentication Code) fields, which are used with cookies to mitigate CPU-exhaustion attacks. It is important to take care of such attacks because the Diffie-Hellman calculations can be CPU intensive and bad-faith actors can take advantage of it. The ReDoS attack is a notable example of it.

B. Handshake Response

After the initiation, a response is sent from the responder to the initiator which again holds an unencrypted ephemeral public key generated by the responder. It also contains an empty buffer, which has been encrypted using a key that is calculated based on the ephemeral private key and the static key of the initiator.

WireGuard: The Next-Gen VPN Protocol (6) Fig. 6: Handshake Response Packet in Wireshark

C. Transport Data Packet

After the handshake packets are exchanged, shared session keys are calculated based on the exchanged data. There are two session keys, one for encrypting data that is about to be sent and another for decrypting data that has been received. Both the initiator and the responder have these session keys in their state.

WireGuard: The Next-Gen VPN Protocol (7) Fig. 7: Transport Data Packet in Wireshark

WireGuard works over UDP which is an unreliable protocol where messages can sometimes appear out-of-order. We don't want that because that could lead to scenarios such as the protocol trying to decrypt a message without a key exchange beforehand. Awkward.

To take care of that, WireGuard uses a counter field in the data packets paired with an internal sliding window to keep track of the packets that have been received. This counter field is always incremented by 1.

D. Cookie Reply Packet

As mentioned earlier, WireGuard uses MAC fields in the handshake packets for security reasons. If the responder is ever under load from the CPU intense calculations that are happening in after the Handshake Initiation packet, it may choose to not go ahead with sending a Handshake Response packet, but instead can respond with a Cookie Reply packet.

WireGuard: The Next-Gen VPN Protocol (8) Fig. 8: Cookie Reply Packet in Wireshark

This packet contains a cookie that is calculated using the BLAKE2 hash function with two inputs: a secret random value maintained by the responder that changes every 120 seconds, and the IP address of the initiator.

Upon receiving this cookie packet, the initiator must store the decrypted cookie value and wait for a certain amount of time before attempting a handshake again with the MAC value obtained from the last cookie.

Further details can be found in the official documentation.

Reception from the Internet

Since its debut in 2017, WireGuard has garnered favorable opinions from security researchers and famous tech personalities. This is largely due to the fact that it is faster than its counterparts, while not compromising with security.

It has been integrated into the Linux 5.6 Kernel in March 2020. In 2021, it had also been added to the Windows Kernel. This adds to the speed of this protocol, as the cryptographic calculations run faster in the kernel-space than the user-space.

Popular VPN vendors such as ProtonVPN, SurfShark, and NordVPN support WireGuard as a VPN protocol. Although, NordVPN does it with a slight twist as they have made their own protocol known as NordLynx on top of the open-source WireGuard codebase.

There have been some privacy concerns as well. Since WireGuard does not support dynamic IP addresses by design, it assigns a single IP address to a user which is logged in the memory. WireGuard does not ensure that no identifiable user data is stored in the VPN server.

However, there are solutions to this problem. In the implementation of NordLynx, they get around this concern by using something referred to as a “Double NAT System” which uses two interfaces instead of one and supports dynamic short-term IP addresses.

WIREGUARD SUPPORT IN BREAKINGPOINT SYSTEMS

As of the 2022-18 release of the ATI Strikepack subscription, WireGuard is supported as an application protocol that you can test your network with. With BreakingPoint Systems, you can mix WireGuard traffic with thousands of other types of application traffic to test the resiliency of your network devices.

WireGuard: The Next-Gen VPN Protocol (9) Fig. 9: WireGuard in BreakingPoint Systems

For more details about Keysight BreakingPoint Systems and to test your network equipment against the most updated network traffic available on the Internet, visit the BreakingPoint Systems landing page.

WireGuard: The Next-Gen VPN Protocol (2024)

FAQs

WireGuard: The Next-Gen VPN Protocol? ›

WireGuard is a new, open-source VPN protocol designed with state-of-the-art cryptography, which is the practice of coding sensitive information so only the intended recipients can interpret its meaning. It provides faster, easier-to-use, and more secure pathways for user devices to connect with VPN servers worldwide.

Is WireGuard a good VPN protocol? ›

While other protocols might be able to improve speeds by compromising on security, WireGuard provides very strong encryption. This combination of speed and security makes it one of the best VPN protocols available.

Which protocol is better OpenVPN or WireGuard? ›

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.

Is WireGuard free to use? ›

WireGuard is a communication protocol and free and open-source software that implements encrypted virtual private networks (VPNs), and was designed with the goals of ease of use, high speed performance, and low attack surface.

Why do I have WireGuard on my PC? ›

WireGuard is an encryption and communication protocol that your VPN uses to protect the traffic channel you open up between your devices and your VPN company's servers.

How much does WireGuard cost? ›

Since WireGuard and OpenVPN are free software, there is no expense associated with using them. Though there are some free solutions, you'll still need to pay for a VPN subscription. Since WireGuard and OpenVPN are free software, there is no expense associated with using them.

Is WireGuard the same as NordVPN? ›

NordLynx is NordVPN's revolutionary technology built around the WireGuard® VPN protocol. It helps you connect to NordVPN servers faster and improves your VPN connection speeds without compromising security or privacy.

Is anything better than WireGuard? ›

Tailscale does more than WireGuard, so that will always be true. We aim to minimize that gap, and Tailscale generally offers good bandwidth and excellent latency, particularly compared to non-WireGuard VPNs.

How safe is WireGuard VPN? ›

Is WireGuard secure? WireGuard is considered by many to be one of the safest, most secure VPN protocol options available today. Simplified design using less code equals fewer bugs and security vulnerabilities, while WireGuard's faster state-of-the-art cryptography employs superior default security settings.

What is the most advanced VPN protocol? ›

IKEv2 – Internet Key Exchange

Based on the IPSec framework, IKEv2 is the most recent and advanced VPN protocol.

What is the most secure VPN option? ›

  • NordVPN.
  • Surfshark.
  • Private Internet Access VPN.
  • Hotspot Shield.
  • Norton Secure VPN.
  • IPVanish.
  • ExpressVPN.
  • CyberGhost.
May 31, 2024

What is the best port to run WireGuard on? ›

What ports do you use for WireGuard? UDP ports 53, 80, 443, 1194, 2049, 2050, 30587, 41893, 48574, 58237.

Why not to use WireGuard? ›

Unreliable Monotonic Counter. WireGuard uses the system time as a reliable monotonic counter. If this jumps forward, a user might DoS their own keys, by making it impossible to later have a value larger, or an adversary controlling system time could store a handshake initiation for use later.

What is the point of WireGuard? ›

WireGuard is a new-generation VPN protocol that radically streamlines secure communication for its end users and network administrators.

Does WireGuard mask your IP? ›

As explained above WireGuard does not allocate a dynamic IP address to the VPN user. And, it indefinitely stores user IP addresses on the VPN server until the server reboots. So, there is no anonymity and privacy in WireGuard.

Do I need public IP for WireGuard? ›

We recommend obtaining a public IP address from your ISP. Learn more" "Your WAN IP address is assigned via DHCP and may regularly change. This will cause VPN clients to disconnect until they are reconfigured with the new IP address.

How do I activate WireGuard VPN? ›

  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

Does McAfee use WireGuard? ›

McAfee Security uses the WireGuard protocol by default

By default, McAfee Security uses the WireGuard protocol, which is the latest in VPN protocol technology. When the VPN protocol setting is set to Auto, WireGuard is used before any of the other protocols.

Can WireGuard be detected? ›

Yes, WireGuard can be detected. It doesn't do VPN obfuscation, mostly because of the insistence on UDP transmission mode.

Is WireGuard easy to setup? ›

Simple & Easy-to-use

WireGuard aims to be as easy to configure and deploy as SSH. A VPN connection is made simply by exchanging very simple public keys – exactly like exchanging SSH keys – and all the rest is transparently handled by WireGuard. It is even capable of roaming between IP addresses, just like Mosh.

Is ExpressVPN better than WireGuard? ›

Is ExpressVPN's Lightway WireGuard? No, ExpressVPN's Lightway protocol is not WireGuard. ExpressVPN built Lightway from the ground up to meet the privacy, security, and performance needs of its users.

What is an onion over VPN? ›

Onion over VPN, also called Tor over VPN, is when you connect to a VPN and then open Tor browser. This approach protects your digital identity and data better than using either alone. You get the VPN's security and privacy with Tor's anonymity.

Is WireGuard a safe VPN? ›

WireGuard is considered safe for torrenting due to its strong encryption and efficient code. Additionally, the simplicity and efficiency of WireGuard contribute to its speed, which is a significant advantage for P2P traffic. You can securely torrent using WireGuard without creating delays.

Should I use WireGuard or OpenVPN? ›

Overall, WireGuard is the faster of the two protocols. OpenVPN, if configured in UDP mode, will offer similar latency, but it will still require higher data usage. Note that WireGuard runs only in UDP mode. Both OpenVPN and WireGuard use strong unbroken ciphers.

Which VPN protocol is best? ›

The best VPN protocol for you depends on a number of factors, including what device you're using, how much balance between security and speed you want, what type of activities you're doing online, and more. OpenVPN and WireGuard are generally considered the best VPN protocols for day-to-day use.

Is WireGuard better than IPSec? ›

Compared to IPsec, the WireGuard connection has a 20% lower latency and a 15% higher throughput. When it comes to performance, WireGuard usually performs better than IPSec and even quicker than other VPN protocols like OpenVPN.

Top Articles
Latest Posts
Article information

Author: Fredrick Kertzmann

Last Updated:

Views: 5596

Rating: 4.6 / 5 (66 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Fredrick Kertzmann

Birthday: 2000-04-29

Address: Apt. 203 613 Huels Gateway, Ralphtown, LA 40204

Phone: +2135150832870

Job: Regional Design Producer

Hobby: Nordic skating, Lacemaking, Mountain biking, Rowing, Gardening, Water sports, role-playing games

Introduction: My name is Fredrick Kertzmann, I am a gleaming, encouraging, inexpensive, thankful, tender, quaint, precious person who loves writing and wants to share my knowledge and understanding with you.