The guide is based on debian13-minimal, but it should work on debian-13-xfce or debian-13.
qvm-template install debian-13-minimalqvm-clone debian-13-minimal debian-13-minimal-openvpn> ℹ️ The following steps are required to install packages in the new template, as it's a minimal template, you can't use sudo from a regular terminal.
qvm-run -u root debian-13-minimal-openvpn xtermapt install -y qubes-core-agent-networking qubes-core-agent-network-manager network-manager-openvpn-gnomeadduser user netdev> ℹ️ The following steps will create an AppVM qube that will connect to the OpenVPN server and be used as a NetVM for other qubes.
qvm-create --property provides_network=true --template debian-13-minimal-openvpn --label red --property maxmem=512 sys-vpn-openvpnqvm-service --enable sys-vpn-openvpn network-manager trueMove the OpenVPN configuration (unzip the file before if needed, the appvm does not have the tools to unzip) to the qube sys-vpn-openvpn you just created.
This can be done by right-clicking on the downloaded file in the file explorer of the Qube that downloaded the configuration file, and choose "Move to other qube..." menu entry in the contextual menu.
qvm-run -u root sys-vpn-openvpn xterm/home/user/QubesIncoming/...User name and Password> ℹ️ Autoconnect on boot can't work if you store the passwords as the user, which is the case in this guide.
sys-vpn-openvpn run a terminal as normal usermkdir -p ~/.config/systemd/user
cat << 'EOF' > ~/.config/systemd/user/autoconnect.service
[Service]
Type=oneshot
ExecStart=/bin/sh -c 'nmcli connection up "$(nmcli connection show | awk "/vpn/ { print \$1 }" | sort -R | head -n 1)"'
[Install]
WantedBy=default.target
EOF
systemctl --user daemon-reload
systemctl --user enable autoconnect
> 👉 ℹ️ This creates a service running as user on boot that selects a random VPN connection and connect to it.
> ℹ️ This method uses the command line version of the firewall as it allows to block both ICMP (ping) and DNS packets, whereas the firewall tab in the qube settings does not block ICMP and DNS.
qvm-firewall sys-vpn-openvpn resetqvm-firewall sys-vpn-openvpn add accept dsthost=1.2.3.4 dstports=1194 proto=udpqvm-firewall sys-vpn-openvpn del --rule-no 0
```