Custom DNS sys-net

Hi,
i’m using lasted version of Qubes OS 4.2.4.
I would like to know how to force Custom DNS in sys-net (dispVM).
Right now it get DNS from DHCP ISP, so not good.
Someone can help me?
thank you
Best regards

You could settings your dispVM sys-net like you want: dns, password, etc… :slight_smile:
Said thanks to @szz9pza :wink:

you can use dnscrypt too:

of @qubist
with the nftables translation of @DVM :

1 Like

Maybe just edit /etc/resolv.conf?
If you are asking how to persistent store the config for disposable net vm, my solution is store wifi ssid and password to a file in dom0 and write a script to automatic read the info and execute qvm-run to connect wifi and setup some other configs.

### Part of the script look like this.
qvm-run -u root --pass-io "$NETVM" " 
    if [[ \$(nmcli radio wifi) == \"disabled\" ]]; then
        nmcli radio wifi on
	sleep 0.5
    fi
    if ! nmcli connection up \"$selected_ssid\"; then
        if nmcli device wifi connect \"$selected_ssid\" password \"$PASSWORD\" $HIDDEN_ARG; then
		    nmcli connection modify \"$selected_ssid\" connection.autoconnect no
	    fi
    fi
    echo "..." > /etc/resolve.config
"

Hi, thank you, i read that but i think there was a misunderstood because i don’t need to save wifi password and with Custum DNS i meant not MY but public one (of my choise, e.g mullvad). so i don’t like to create a custom dns server in local. how is the solution in this case? thank you

Hi Thank you.
so to to a test i just have to change dns from /etc/resolv.conf from disposable sys-net? and if works change it from sys-net template (fedora-41-xfce)? is it right? thank you
Last thing, why you talk about wifi? i dont need it or keep credential just persistent DNS of my choise. thank you again
best regards

In your .nmconnection file, In the [ipv4] section, you have the option to choose your DNS, not just your wifi password, for example:

[wifi]
cloned-mac-adress=random
mode=infrastructure
ssid=Your_ssid

[wifi-security]
key-mgnt=wpa-psk
psk=Your_password  #or nothing if you don't want to save it

[ipv4]
dns=Your_public_dns;
method=auto

All the configurations you are doing in NetworkManager are in .nmconnection file .
It is in /etc/NetworkManager/system-connections/

Hi,
thank you!
so i need to edit .nmconnection file in /etc/NetworkManager/system-connections/ inside sys-net and because sys-net is disposable i also need to copy it to /rw//config/NM-system-connections folder of sys-net’s dvm-template? or i can just edit edit .nmconnection file in /etc/NetworkManager/system-connections/ into sys-net’s dvm-template? sorry but i’m new in linux and Qubes. thanks so much for help!

Just make like the topic:

It explain for the wifi password but it’s the same for all your configuration you make in NetworkManager.

Ok thank you, i see, but its seem a bit complicated. if i do as following can be also ok? it seems more easy:

  1. From DVM Template sys-net (es. fedora-XX-dvm) do:

ls /etc/NetworkManager/system-connections/

so i can see the “connection name” like Wired connection 1.nmconnection

sudo nano /etc/NetworkManager/system-connections/“Wired connection 1.nmconnection”

  1. edit file, example

[ipv4]
method=auto
dns=xxx;
ignore-auto-dns=true

Ctrl+O, enter key, Ctrl+X

  1. Give the right permission to file:

sudo chmod 600 /etc/NetworkManager/system-connections/“Wired connection 1.nmconnection”

  1. shut down template fedora-XX-dvm

  2. reboot DVM sys-net

dispsable template is an AppVm not a template. It doesn’t keep the changements in /etc/
I think you could, copy your 1.nmconnection in the directory /rw/config/NM-system-connections/ in your fedora-XX-dvm.
Then shutdown fedora-XX-dvm and launch sys-net.

Thank you!
Is DOH or DOT DNS supported by default like Mullvad DNS outside VPN.

i don’t know, i don’t use Mullvas DNS

See image in attachment. I dont have folder NM-system-connections.
Some idea why?
Thanks

sudo mkdir /rw/config/NM-system-connections

Solved, with standard DNS all works fine. :slight_smile:
im open a new topic hope someone else can helo me to make mullvad dns DOH and DOT works.
I tryed but they don’t work
Thank you

make solved for this topic for others people