WireGuard
1. Overview
WireGuard is a VPN technology designed for secure network connections. It creates an encrypted tunnel between different networks, allowing devices in different locations to communicate securely as if they were on the same local network.
Compared with traditional VPN solutions, WireGuard offers higher speed, more stable connections, and simpler configuration. With only minimal setup, users can remotely access internal network devices, transfer data across networks, and ensure the security and privacy of communications.
WireGuard supports multiple operating systems and devices, making it suitable for remote work, device management, home or enterprise networking, and other common scenarios. It is a reliable and easy-to-use VPN solution.
2. Tutorial
The test environment described in this document was deployed and validated on Tencent Cloud with Ubuntu 22.04. Other cloud service providers have not been individually tested. If you are using a different cloud platform, please follow the configuration steps in this document and make appropriate adjustments according to your actual network conditions and operating system environment.
Recommended cloud platforms are as follows:
-
Domestic cloud providers: Alibaba Cloud, Tencent Cloud
-
Overseas cloud providers: Oracle Cloud, Google Cloud, Amazon Web Services (AWS), Microsoft Azure
2.1 Server-Side Configuration
- Install Docker by referring to the following guide: Tencent Cloud Ubuntu 22.04 Docker Setup.
- To accelerate Docker image pulls, configure the Tencent Cloud Docker registry mirror. Edit the /etc/docker/daemon.json file:
vim /etc/docker/daemon.json
- Press i to enter insert mode, add the following content, then save and exit:
{"registry-mirrors": ["https://mirror.ccs.tencentyun.com"]}
- To avoid failures when pulling resources from GitHub, you may configure DNS mappings for GitHub-related domains on the server:
sudo tee -a /etc/hosts <<'EOF'140.82.112.4 github.com185.199.108.133 raw.githubusercontent.comEOF
- Result:

- Result:
- Load kernel modules.
modprobe tunmodprobe wireguard || truemodprobe nf_conntrackmodprobe nf_natmodprobe iptable_nat
- Enable IPv4 forwarding.
sysctl -w net.ipv4.ip_forward=1echo "net.ipv4.ip_forward = 1" > /etc/sysctl.d/99-ipforward.confsysctl --system
- Pull the WireGuard management image.
docker pull ghcr.io/wg-easy/wg-easy
- Generate an admin password hash (required when creating the container).
Replace
adminwith the password you want to use for the management interface.docker run --rm -it ghcr.io/wg-easy/wg-easy wgpw 'admin'# Output examplePASSWORD_HASH='$2a$12$36Q68Cur5DoBrMXvLoergOuVcF1lugRqpn3fCAnG38mwq0CLLi/Wy' - Create the wg-easy container:
docker run -d --name=wg-easy -e LANG=chs \-e WG_DEFAULT_DNS=114.114.114.114 \-e WG_HOST=<SERVER_IP> \-e PASSWORD_HASH=<PASSWORD_HASH> \-e PORT=<WEB_PORT default 51821> \-e WG_PORT=<VPN_PORT default 51820> \-v ~/.wg-easy:/etc/wireguard \-p 51820:51820/udp -p 51821:51821/tcp \--cap-add=NET_ADMIN --cap-add=SYS_MODULE \--sysctl="net.ipv4.conf.all.src_valid_mark=1" --sysctl="net.ipv4.ip_forward=1" \--restart unless-stopped ghcr.io/wg-easy/wg-easydocker run -d --name=wg-easy -e LANG=chs \-e WG_DEFAULT_DNS=114.114.114.114 \-e WG_HOST=43.163.9.243 \-e PASSWORD_HASH='$2a$12$36Q68Cur5DoBrMXvLoergOuVcF1lugRqpn3fCAnG38mwq0CLLi/Wy' \-e PORT=51821 -e WG_PORT=51820 \-v ~/.wg-easy:/etc/wireguard \-p 51820:51820/udp -p 51821:51821/tcp \--cap-add=NET_ADMIN --cap-add=SYS_MODULE \--sysctl="net.ipv4.conf.all.src_valid_mark=1" --sysctl="net.ipv4.ip_forward=1" \--restart unless-stopped ghcr.io/wg-easy/wg-easy
- Open firewall ports: Allow UDP 51820 and TCP 51821 on the server firewall.

- Log in to the admin panel: Visit http://PUBLIC_IP:51821 in your browser and log in using the admin password you set earlier.
- Create clients: Add new devices in the admin panel and download the client configuration file or QR code.


2.2 PicoKVM Setup
- Open the downloaded PicoKVM configuration file, paste the WireGuard configuration content into it, and click Start to establish the connection.

- After configuring the WireGuard client on your computer, you can access the KVM device through the VPN network.
2.3 Windows Setup
- Download and install the WireGuard client.

- Open the software and import the tunnel configuration file (.conf).
- Click Connect after importing to establish the VPN connection.

- Once connected, open a browser and enter the PicoKVM IP address (for example, 10.8.0.2). Use the IP shown in the admin panel if different.
2.4 Ubuntu Setup
- Install WireGuard:
sudo suapt install wireguard -y
- Load kernel modules:
modprobe tunmodprobe wireguard || truemodprobe nf_conntrackmodprobe nf_natmodprobe iptable_nat
- Enable IPv4 forwarding:
sysctl -w net.ipv4.ip_forward=1echo "net.ipv4.ip_forward = 1" > /etc/sysctl.d/99-ipforward.confsysctl --system
- Copy the downloaded Linux.conf file to /etc/wireguard/.
cp Linux.conf /etc/wireguard/
- Run wg-quick up Linux to activate the configuration.

After configuration is successful, return to the web admin panel and you should see traffic activity. At this point you can log in to KVM via the browser. Note that your computer should not use a proxy, otherwise access may fail.
