Configuring WireGuard Peers on Ubuntu Server for Two Win11 Clients

Abstract: Enables direct communication between two Windows 11 clients over a WireGuard tunnel by configuring IP forwarding and peer routing on an Ubuntu server.

Created: 2026-09-04 by
To configure WireGuard peers on an Ubuntu server for two Windows 11 clients with IPs 10.10.0.1 and 10.10.0.2, you must generate distinct key pairs for each endpoint and ensure the server configuration allows traffic forwarding between them. The server acts as a router, requiring specific kernel parameters to be enabled so that packets arriving from one client are correctly routed to the other through the virtual tunnel interface.

Prerequisites and Server Preparation

Before generating keys or editing configuration files, ensure your Ubuntu server has the necessary packages installed. You will need wireguard-tools for key generation and configuration management, and iptables or nftables for packet filtering if strict security is required. For most basic setups, enabling IP forwarding at the kernel level is the critical first step. Run the following command to check if IP forwarding is currently enabled:
sysctl net.ipv4.ip_forward
If the output is net.ipv4.ip_forward = 0, you must enable it temporarily by running sudo sysctl -w net.ipv4.ip_forward=1. To make this change persistent across reboots, edit the file /etc/sysctl.conf and add or modify the line net.ipv4.ip_forward=1. After saving the file, apply the changes using sudo sysctl -p. This step is vital because without IP forwarding, the server will drop any packets that are not destined for its own IP address, preventing client-to-client communication.

Generating Cryptographic Keys

WireGuard relies on asymmetric cryptography. You need to generate a private and public key pair for the server and each of the two Windows 11 clients. Generate these keys on the machine where they will reside to ensure security. On the Ubuntu server, execute:
wg genkey | tee server_private.key | wg pubkey > server_public.key
Repeat this process for Client 1 (Win11) and Client 2 (Win11). Store the private keys securely; never share them. The public keys will be used in the configuration files of the respective endpoints.

Configuring the Ubuntu Server

Create a new configuration file for WireGuard on the server, typically located at /etc/wireguard/wg0.conf. The configuration defines the listening port, private key, and allowed IPs for each peer. Crucially, you must allow traffic from both clients.
[Interface]
Address = 10.10.0.3/24
ListenPort = 51820
PrivateKey = SERVER_PRIVATE_KEY

[Peer]
# Client 1
PublicKey = CLIENT1_PUBLIC_KEY
AllowedIPs = 10.10.0.1/32

[Peer]
# Client 2
PublicKey = CLIENT2_PUBLIC_KEY
AllowedIPs = 10.10.0.2/32
Replace SERVER_PRIVATE_KEY, CLIENT1_PUBLIC_KEY, and CLIENT2_PUBLIC_KEY with the actual generated keys. Note that AllowedIPs specifies which IP addresses belong to each peer. By setting them to /32, we restrict traffic to only those specific host IPs, enhancing security. However, if you intend for clients to route internet traffic through the server, you would use 0.0.0.0/0 instead, though this guide focuses on local peer connectivity. After saving the file, start and enable the service:
sudo systemctl enable --now wg-quick@wg0
Verify the status with wg show to ensure the interface is up and peers are recognized.

Configuring Windows 11 Clients

On each Windows 11 machine, install the official WireGuard application. Create a new tunnel and paste the corresponding configuration. For Client 1, the config should look like this:
[Interface]
PrivateKey = CLIENT1_PRIVATE_KEY
Address = 10.10.0.1/24

[Peer]
PublicKey = SERVER_PUBLIC_KEY
AllowedIPs = 10.10.0.2/32, 10.10.0.3/32
Endpoint = SERVER_PUBLIC_IP:51820
PersistentKeepalive = 25
For Client 2, swap the addresses and keys accordingly. The AllowedIPs field here tells the client which destinations to send through the VPN tunnel. Including both the server (10.10.0.3) and the other client (10.10.0.2 for Client 1) ensures that ping requests reach their target. Set the Endpoint to your server's public IP address.

Testing Connectivity and Troubleshooting

Once all configurations are active, test the connectivity. From Client 1, open a command prompt and run ping 10.10.0.2. If successful, Client 2 can also ping Client 1. Similarly, both clients should be able to ping the server at 10.10.0.3. If pings fail, check the following:
  • Firewall Rules: Ensure UDP port 51820 is open on the server’s firewall. On Ubuntu, use sudo ufw allow 51820/udp.
  • IP Forwarding: Confirm net.ipv4.ip_forward is set to 1 on the server.
  • MTU Settings: Windows clients sometimes require an MTU adjustment. Try setting the MTU to 1420 in the Windows WireGuard adapter settings if large packets are dropped.
For deeper insights into client-to-client issues, refer to our guide on Troubleshooting WireGuard Client-to-Client Communication Issues. Additionally, if you need to manage routing more complexly, consider reading about How to Make a Server Not Use VPN as a Default Gateway to avoid routing loops.

Frequently Asked Questions

Why can't my Windows clients ping each other?

The most common reason is that IP forwarding is disabled on the Ubuntu server. Without it, the server drops inter-client packets. Ensure net.ipv4.ip_forward=1 is set in /etc/sysctl.conf.

Do I need to open port 51820 on the server firewall?

Yes, the server must accept incoming UDP traffic on port 51820 for the initial handshake and ongoing communication. Use UFW or iptables to allow this port from trusted sources.

Can I use the same key pair for both clients?

No, each peer must have a unique key pair. Using the same keys will cause conflicts and prevent proper authentication and encryption between the server and individual clients.

What happens if I set AllowedIPs to 0.0.0.0/0?

This routes all internet traffic from the client through the server. While useful for privacy, it requires additional configuration on the server to handle NAT and masquerading, which is beyond simple peer-to-peer ping tests.

How do I verify the WireGuard connection is active?

Run wg show on the server or check the WireGuard app status on Windows. Active connections will show recent data transfer bytes under the "Latest Handshake" section.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More