How to fix the IP of a given VM?

Hello,

I have the following configuration: A->B->C->D
A) AppVM (from Whonix-Workstation-17 template)
B) sys-whonix
C) sys-firewall
D) sys-net

My problem is that the IP of A (10.137.0.x) changes often, e.g., when I install whonix updates and reboot the A and B.

This is a problem because in B I have a line in /usr/local/etc/torrc.d/50_user.conf/ of the form

HiddenServiceDir path
HiddenServicePort 80 ip_of_A 80
HiddenServiceVersion 3

and, of course, the .onion service stops working after the IP ip_of_A of A changes.

QUESTION 1: is it possible to have a fixed/static IP address for A?

QUESTION 2: Question 1 can be extended to the more general case where A is not necessarily coming from the Whonix-Workstation template, that is, where A is an arbitrary VM.


I have found this related discussion:

Can somebody help me move in the right direction? Thank you!

Are you sure that your A qube is an app qube and not a disposable qube?
Check its preferences in dom0:

qvm-prefs A

The IP address should be specified there and it should be static.
I’ve checked this in a new app qube based on a whonix-workstation-17 template and the IP doesn’t change when I restart this qube.

Thank you.
Indeed the command qvm-prefs A gives the same IP shown in the Qube manager GUI.

I haven’t noticed any IP change recently, despite trying to reboot the VMs and the physical machine itself. I’ll monitor the situation and be back here if the problem emerges again.

But in any case I would be curious to know what is the service (and in which VM) that is in charge of assigning these IPs.

What if, for example, I don’t like the IP that was automatically given to a new VM and I want to force it to be 19.137.0.100 (assuming it is not already taken by other VMs)?

Thanks!

The IPs are assigned by Qubes tools in dom0.

I think it’s not supported, but you can hack it by manually setting it in the libvirt config:

But maybe it could conflict with the Qubes tools in dom0 since they may not be aware of your change and reuse the same IP for another qube.

1 Like