Microsoft Hyper-V

2 min

How to deploy a prebuilt Hyper-V VM agent

This article contains a few tips and tricks on how to deploy a pre-built Hyper-V virtual machine image to a Hyper-V host.

Get your pre-built Hyper-V image

  1. Download the Hyper-V image from here:
    https://domotz-vm-images-temp.s3.eu-west-1.amazonaws.com/hyper-v_ubuntu-22.04_Domotz_Agent_3.0.4-4.9.1-b001-0134.zip
  2. Unzip it in a location of your choice.

Deploy the VM

1. Open the Hyper-V Manager > Click on Action > Import Virtual Machine…:

Hyper-V screenshot 1

2. Browse and choose the folder where you extracted the VM Image:

Hyper-V screenshot 2

3. Select the VM image:

Hyper-V screenshot 3

If you are not able the above view provides the message “No virtual machine files found.” message even if you are in the right directory, it may have happened that you are using an old HyperV version.

If this is the case, create a new VM from scratch (selecting Gen 1) using the disk you downloaded from this guide.

4. Select “Copy the virtual machine (create a new unique ID)”:

Hyper-V screenshot 4

5. Select the location where you want to save the VM and the location for its virtual Disks:

Hyper-V screenshot 5
Hyper-V screenshot 6

6. Click on finish.

7. Once the VM is imported make sure the VM is connected to the correct virtual switch configured in bridge mode. By doing this the VM will be able to get a valid IP Address on the network:

Hyper-V screenshot 7

8. Start the VM. 

To login and see the current IP address use the following credentials:

User: domotz
Password: domotz

We strongly recommend to change the password as soon as possible, and in general to not allow SSH to the VM.

9. At the command prompt run command “ifconfig”, the current IP Address will be shown.

10. Activate the agent from a browser access the VM IP address (which you discovered by issuing the ifconfig command) on its port 3000.

For example, http://192.168.1.104:3000

11. Setup a process to keep the Virtual Machine always updated and upgraded to the latest releases. Only the Domotz Agent software is automatically upgraded via SNAPd process.

If the Domotz Agent on the Virtual Machine is supposed to be used for the VPN On Demand, the following commands should be executed from within the Virtual Machine itself (connect via SSH using the above provided credentials):

sudo snap install domotzpro-agent-publicstore
sudo snap connect domotzpro-agent-publicstore:firewall-control
sudo snap connect domotzpro-agent-publicstore:network-observe
sudo snap connect domotzpro-agent-publicstore:raw-usb
sudo snap connect domotzpro-agent-publicstore:shutdown
sudo snap connect domotzpro-agent-publicstore:system-observe

sudo sh -c 'echo tun >> /etc/modules'
sudo modprobe tun

 
This will basically make the Domotz Agent able to control the network stack to create a VPN on Demand tunnel.

After doing that restart the Agent package:
 
sudo snap restart domotzpro-agent-publicstore

If you are looking for information regarding configuring VLANs in HyperV, you might take a look to this article: https://charbelnemnom.com/what-is-vlan-trunk-mode-in-hyper-v-hyperv/

Share via Social Networks

You might also like…

Read more top posts in this category

Want more tips on Network Monitoring?

Ready to get started with Domotz?

  • Powerful
  • Automated
  • Simple
  • Affordable
Start Your Free Trial Contact Sales