This guide is for users who want to change their default (XFCE-based) sys-net to a hardened, minimal Debian 13 setup.
Do I need to change my current sys-net?
Likely, no. A default disposable sys-net provided by a fresh Qubes OS installation is reasonably secure for most users. It already isolates your physical hardware and network drivers from the rest of your system. It automatically spoofs your wireless MAC address, prevents hostname leaks and sets your DHCP client ID to match your MAC address to improve your privacy. (Note that only MAC spoofing of wired connections is not enabled by default.)
For the majority of users, relying on the default configuration is safer than a customized minimal sys-net, because it removes the potential risk of manual misconfiguration.
Only for advanced users
This setup requires Linux knowledge. Only follow this guide if you have the willingness to verify the configurations and if your threat model or hardware requires it. You can find the benefits of hardening sys-net further down, directly under the steps.
Steps: Creating a hardened Debian 13 minimal based sys-net
1. Install a fresh Debian minimal. In Dom0 terminal:
qvm-template install debian-13-minimal
2. Install only the essential packages required. In this guide, we choose IWD over wpa_supplicant to reduce the attack surface and to improve resource efficiency.
Note: Since passwordless root is not installed, you will need to open a terminal by running qvm-run -u root debian-13-minimal xterm from Dom0 Xfce4-terminal. Also you’ll need to know how to use xterm.
In debian-13-minimal, run:
- For systems with an Intel Wi-Fi card::
sudo apt update && sudo apt install -y qubes-core-agent-networking qubes-core-agent-network-manager network-manager iwd firmware-iwlwifi --no-install-recommends
- For systems with a MediaTek Wi-Fi card:
sudo apt update && sudo apt install -y qubes-core-agent-networking qubes-core-agent-network-manager network-manager iwd firmware-mediatek --no-install-recommends
3. Set IWD as WIFI backend and configure Network Manager with the following: (in debian-13-minimal)
sudo nano /etc/NetworkManager/conf.d/90-spoofing.conf
[main]
dhcp=internal
[device]
wifi.scan-rand-mac-address=no
wifi.backend=iwd
[connectivity]
enabled=false
uri=
interval=0
[connection]
ipv4.dhcp-send-hostname=0
ipv6.dhcp-send-hostname=0
wifi.cloned-mac-address=preserve
ethernet.cloned-mac-address=random
ipv4.dhcp-client-id=mac
4. Configure IWD to spoof MAC
Note: Spoofing your MAC address increases privacy. But in some specific threat models, MAC address spoofing may decrease overall security or make you stand out.
Enable MAC spoofing. (in debian-13-minimal)
sudo nano /etc/iwd/main.conf
[General]
AddressRandomization=once
#AddressRandomization=network
AddressRandomizationRange=full
When configuring MAC spoofing, the AddressRandomization should match your threat model.
Once: It will keep the same spoofed MAC address till you reboot sys-net.
Network: Every network sees a completely different spoofed MAC address.
In this configuration once is active.
5. Hardening. (in debian-13-minimal)
These modifications can break other applications, keep in mind that this template should be only used for your sys-net.
sudo nano /etc/modprobe.d/99-security.conf
# If you have Intel
options iwlwifi p2p_disable=1
# If you have MediaTek
# options mt76_core disable_p2p=1
6. Hardening Part 2. Adding hardening sysctl lines. Keep in mind that this setup is tailored for blending in, but with important security improvements included. For example net.ipv4.tcp_timestamps = 0 is more secure but it makes you stand out more, so in this configuration, it is set as 1, what is default. (in debian-13-minimal)
sudo nano /etc/sysctl.d/99-qubes-net-hardening.conf
# Hardening rules/overrides
kernel.kexec_load_disabled = 1
kernel.sysrq = 0
kernel.kptr_restrict = 2
kernel.yama.ptrace_scope = 2
abi.vsyscall32 = 0
dev.tty.ldisc_autoload = 0
net.core.bpf_jit_harden = 2
kernel.unprivileged_userns_clone = 0
vm.memfd_noexec = 2
vm.mmap_rnd_bits = 32
vm.mmap_rnd_compat_bits = 16
fs.protected_fifos = 2
net.ipv4.tcp_rfc1337 = 1
net.ipv4.conf.all.arp_announce = 2
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.default.arp_ignore = 1
net.ipv4.conf.all.drop_gratuitous_arp = 1
net.ipv4.conf.default.drop_gratuitous_arp = 1
net.mptcp.enabled = 0
# as debian default 1
net.ipv4.tcp_timestamps = 1
kernel.panic_on_oops = 1
kernel.oops_limit = 1
kernel.warn_limit = 1
kernel.panic = 10
kernel.traceoff_on_warning = 1
7. Hardening Part 3 (in debian-13-minimal)
sudo nano /etc/security/limits.d/99-disable-coredumps.conf
* hard core 0
* soft core 0
8. Create a DVM Template
Go to Settings, Create New Qube and select Disposable Template
Name it “debian-13-minimal-dvm” and set debian-13-minimal as template.
Set netvm as none
9. Configure debian-13-minimal-dvm to make sys-net sending TTL as 64, to blend in with other Linux devices. Run qvm-run -u root debian-13-minimal-dvm xterm in Dom0 to have root permission to do this steps.
(In debian-13-minimal-dvm)
sudo nano /rw/config/rc.local
# Check name of vm first
REAL_VM_NAME=$(qubesdb-read /name)
# Only set TTL rule if it is vm sys-net
if [ "$REAL_VM_NAME" = "sys-net" ]; then
# Create the table if it doesn't exist
nft add table ip target_mangle
# Create the chain linked to the postrouting hook
nft add chain ip target_mangle outbound_normalize '{ type filter hook postrouting priority mangle ; }'
# Force TTL to 64 for all outward traffic (except local loopback)
nft add rule ip target_mangle outbound_normalize oif != "lo" ip ttl set 64
fi
10. Create sys-net
Already using a disposable sys-net?
Simply change the template to the new created debian-13-minimal-dvm.
Not using a disposable sys-net yet?
Go to settings, create New Qube, choose Named Disposable. Name it sys-net-2.
Set debian-13-minimal-dvm as template and netvm as none
Make sure to enable “provides network”
Make sure to assign your network card in devices tab.
Make sure to enable minimal-netvm in service tab, save all.
Shut down you current sys-net and test your new sys-net-2.
When everything works, change the netvm of your sys-firewall to your created new sys-net-2. Delete your old sys-net and rename sys-net-2 to sys-net.
11. Hardening Part 4, with kernel boot options. Forcing security policy by kernel.
Run in Dom0, Xfce terminal:
qvm-prefs sys-net kernelopts "page_alloc.shuffle=1 init_on_alloc=1 init_on_free=1 ipv6.disable=1 randomize_kstack_offset=on slab_nomerge"
Done!
Some reasons for a minimal sys-net with hardening
Security reasons
Since sys-net is treated as untrusted, we can assume that a sophisticated attacker could gain control over your sys-net vm. Qubes OS is designed to protect the rest of your system from such attacks because your sys-net is isolated.
And if you use a disposable sys-net, an attacker loses all access and must start from scratch after a reboot. That is one of Qubes OS’s powerful tools to protect your system. Hardening sys-net sounds useless.
However, sophisticated attackers with access to your sys-net may still try to use their time inside an active session to break out of the VM and/or gain persistent access. While this is rare, it remains a technical possibility. (One that most users can ignore, but high-risk users must consider.)
Defense-in-depth
In the past, many vulnerabilities in Linux and Xen have been discovered that could affect Qubes OS as well. We can assume that there are almost certainly similar, unknown/unpatched zero-day vulnerabilities in both the Linux kernel and the Xen hypervisor. Hardening sys-net must be seen as defense-in-depth.
By using a minimal template, you remove extra code and tools an attacker could use. By restricting root access and separating user privileges, you limit their options. This makes it much harder for them to gain full control inside your sys-net in the first place.
Overcoming hardware limitations
Using a minimal sys-net with IWD uses less RAM and CPU resources than a sys-net based on a default XFCE template. Switching (correctly) to a minimal sys-net will lead in general to better overall performance.
Devices with limited RAM may also experience issues or crashes when updating a bloated template. An issue I experienced myself on my 8GB RAM device. Using a minimal template allows you to update a smaller essential template separately, which helps prevent resource issues during template updates.
While some hardening steps in this setup are optional if your goal is to reduce resource usage, keeping them is still beneficial for the security reasons mentioned above.
Warning
This template should only be used for sys-net and potentially for sys-firewall. Using this template for other tasks and installing extra software will introduce risks and stability issues. Only install more if you know what you are doing. In that case, consider installing apparmor and modify some sysctl lines.
Final note about this thread
This thread didn’t start out as a guide, so some of the comments below might seem unrelated.