没有不值得去解决的问题,也没有不值得去学习的技术!

Configure ZgoCloud, Wstunnel, and Clash Verge Rev to Auto-Start on Boot in Ubuntu 26.04

Figure 12: All website tests passed after boot

I had been using the ZgoCloud + wstunnel + Clash Verge Rev setup on Windows, and it was quite stable. Recently, I wanted to replicate this setup on Ubuntu 26.04 and have it automatically connect on boot without manually running commands every time. After tinkering for an afternoon, I finally got it working. I am documenting the process as a personal note, so I can follow it if I ever reinstall my system.

1. Components I Used

  • VPS provider: ZgoCloud (with wstunnel + WireGuard already configured on the server side)
  • Local tunneling tool: wstunnel v10.5.5 (the version must match the server side)
  • Proxy client: Clash Verge Rev (using its WireGuard node and traffic splitting)
  • System: Ubuntu 26.04, laptop with an x86_64 architecture

2. Installing Clash Verge Rev

I initially searched for “Clash” in the Ubuntu “Software” app, but the results were not what I needed (Figure 1). I later checked GitHub and found that Clash Verge Rev only provides .deb and .AppImage, and is not listed in the store.

Figure 1: Clash Verge Rev is not found in the software store

I downloaded Clash.Verge_2.5.1_amd64.deb (since my computer is x86_64). After downloading, I right-clicked the .deb file in the file manager and selected “Open With” → “Software Install” (Figure 2). The system popped up an installation window; I clicked “Install” and entered my password (Figure 3).

Figure 2: Opening the .deb file with "Software Install"

Figure 3: Click install and enter password

After installation, the Clash Verge Rev icon appeared in the application menu.

3. Deploying the wstunnel Client

The wstunnel server version I am using is v10.5.5, so the client must also be this version, otherwise it will fail to connect. I downloaded wstunnel_10.5.5_linux_amd64.tar.gz from erebe/wstunnel.

After downloading, I right-clicked the archive → “Extract to…”, and extracted it to the current directory (Figure 4). It extracted a folder containing only a single wstunnel executable file.

Figure 4: Selecting to extract to the current location

I needed to place this wstunnel in the system PATH, such as /usr/local/bin. I opened the file manager, pressed Ctrl+L, entered /usr/local/bin, and found that the directory was empty (Figure 5).

Open the file manager, press Ctrl+L and enter /usr/local/bin, and find that this directory is empty (Figure 5).

The right-click paste option was grayed out due to insufficient permissions. I found the graphical approach cumbersome, so I just used the command:

Bash
sudo cp /home/wangqiang/下载/wstunnel_10.5.5_linux_amd64/wstunnel /usr/local/bin/
sudo chmod +x /usr/local/bin/wstunnel

Then I checked the version:

Bash
$ /usr/local/bin/wstunnel --version
wstunnel-cli 10.5.5

No issues there (top part of Figure 6).

Figure 6: Command-line copy, permission grant, and version test

Next, I created a startup script named ~/start-vpn.sh in my home directory with the following content (remember to replace the server IP and domain with your own):

Bash
#!/bin/bash
/usr/local/bin/wstunnel client -L udp://127.0.0.1:51820:127.0.0.1:51820?timeout_sec=0 --tls-sni-override wg.shuijingwanwq.com wss://154.21.196.249:443

I granted it execution permissions:

Bash
chmod +x ~/start-vpn.sh

I used cat to verify the content (middle part of Figure 6).

4. Enabling wstunnel to Start on Boot (systemd User Service)

I did not want to manually execute nohup ~/start-vpn.sh ... every time I boot up, as it is too much hassle. So, I used a systemd user service to manage it.

First, I created the service file:

Bash
mkdir -p ~/.config/systemd/user
nano ~/.config/systemd/user/wstunnel.service

With the following content:

Bash
[Unit]
Description=Wstunnel Client for VPN
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
ExecStart=/home/wangqiang/start-vpn.sh
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=default.target

After saving, I reloaded systemd, enabled the service, and started it immediately:

Bash
systemctl --user daemon-reload
systemctl --user enable wstunnel.service
systemctl --user start wstunnel.service

To check the status:

Bash
$ systemctl --user status wstunnel.service
● wstunnel.service - Wstunnel Client for VPN
     Active: active (running) since ...

The output showed that the service was running (Figure 7). I also checked the port listening:

Bash
$ ss -lun | grep 51820
UNCONN 0      0          127.0.0.1:51820      0.0.0.0:*

This indicated that the UDP port was up.

Figure 7: systemd service running normally

5. Preparing the Clash Configuration File

I had already debugged a ZgoCloud-VPN.yaml file on Windows, which defines the WireGuard node (public key, private key, preshared key) and traffic splitting rules. I copied it directly to Ubuntu and placed it in my home directory:

Bash
vi ~/ZgoCloud-VPN.yaml

I pasted the content in and saved it. The core part is the type: wireguard proxy configuration. For specific configuration details, refer to: Troubleshooting Record: Resolving the DNS Deadlock Issue Where “Some Websites Are Inaccessible” Under Clash Verge + Wstunnel + WireGuard

6. Importing the Configuration into Clash Verge Rev

I opened the Clash Verge Rev GUI, clicked “Subscriptions” on the left, then clicked “New” in the top right corner → and selected the “Local” type (Figure 6). I entered ZgoCloud-VPN as the name, clicked “Select File”, chose ~/ZgoCloud-VPN.yaml, and saved.

Figure 6: Creating a new local configuration
Figure 6: Creating a new local configuration

After importing, I right-clicked this configuration in the subscription list and selected “Use”. Then I switched to the “Proxies” page and could see the ZgoCloud-WG WireGuard node (Figure 7).

After importing, right-click this configuration in the subscription list and select "Use".
After importing, right-click this configuration in the subscription list and select “Use”.

I went back to the “Home” page and turned on the “System Proxy” switch (Figure 8).

Go back to the "Home" page and turn on the "System Proxy" switch (Figure 8). At this point, the browser can already access the external network.

At this point, the browser could already access the external network (Figure 9), and the website test passed.

At this point, the browser can already access the external network (Figure 9), and the website test passes.

7. Enabling Clash Verge Rev to Start on Boot

In Clash Verge Rev’s “Settings” → “System Settings”, there is a “Start on Boot” switch, which I turned on (Figure 10). This way, the software will automatically start every time I log into the desktop.

In Clash Verge Rev's "Settings" → "System Settings", there is a "Start on Boot" switch, which I turned on (Figure 10). This way, the software will automatically start every time I log into the desktop.
In Clash Verge Rev’s “Settings” → “System Settings”, there is a “Start on Boot” switch, which I turned on (Figure 10). This way, the software will automatically start every time I log into the desktop.

8. Reboot Test

After completing all the above steps, I rebooted my computer. After logging back into the desktop:

  • Checked the wstunnel service: systemctl --user status wstunnel.service showed active (running), and the logs contained New UDP connection and TLS handshake information (Figure 11).
  • Tested Google, YouTube, GitHub, and Apple in Clash Verge Rev; all worked normally (Figure 12).
Check the wstunnel service: systemctl --user status wstunnel.service shows active (running), and the logs contain New UDP connection and TLS handshake information (Figure 11).

Figure 12: All website tests passed after boot

9. Pitfalls I Encountered

  1. Do not manually install the system’s WireGuard package. sudo apt install wireguard is unnecessary because the mihomo core built into Clash Verge Rev already implements WireGuard in userspace.
  2. The wstunnel versions must match. The server is v10.5.5, so the client must also be v10.5.5, otherwise there might be protocol incompatibilities.
  3. systemd service failed to start, reporting Address in use. This was because I had previously run a wstunnel manually using nohup, which occupied port 51820. I executed pkill wstunnel to kill the manual process, and then starting the systemd service worked fine.

10. My Daily Experience Now

Boot → log into desktop → open the browser and directly access the external network. Both wstunnel and Clash Verge Rev run automatically in the background, requiring no manual intervention at all. Domestic websites connect directly, foreign websites go through the VPN, and the traffic splitting rules handle routing automatically. The speed is sufficient for watching YouTube in 4K, and port 443 + TLS camouflage has never been blocked.

Although I ran into a few minor pitfalls when porting this setup from Windows to Ubuntu, I am very satisfied with the final result. I documented this process so that if I ever need to reinstall my system or change computers, I can follow this article to do it all over again.


If you have similar needs, I hope my record provides some reference. However, everyone’s network environment and configuration are slightly different; I have only written about my own approach and cannot guarantee it will be universally applicable. Good luck with your tinkering~

关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系