NIC is assigning different IP in Window server 2019 VM

I have create a template for Windows Server 2019 and created a VM using that template. During the creation of the VM it ask for the driver installation . It is only showing the diver of windows 10, 8, 7 . I have downloaded the Windows virtio image from the opennebula appstore .

How can I Create a template for Windows Server 2012, 2016, 2019.

Here is my template

CONTEXT = [
NETWORK = “YES”,
SSH_PUBLIC_KEY = “$USER[SSH_PUBLIC_KEY]” ]
CPU = “4”
DESCRIPTION = “WINDOWS_2019-TEMP”
DISK = [
IMAGE = “windows-2019-iso”,
IMAGE_UNAME = “oneadmin” ]
DISK = [
IMAGE = “Windows VirtIO Drivers”,
IMAGE_UNAME = “oneadmin” ]
DISK = [
IMAGE = “WIN-CONTEXT”,
IMAGE_UNAME = “oneadmin” ]
DISK = [
DEV_PREFIX = “vd”,
IMAGE = “WINDOWS-DATABLOCK”,
IMAGE_UNAME = “oneadmin” ]
GRAPHICS = [
LISTEN = “0.0.0.0”,
PASSWD = “”,
PORT = “5966”,
TYPE = “VNC” ]
HYPERVISOR = “kvm”
INPUT = [
BUS = “usb”,
TYPE = “tablet” ]
INPUTS_ORDER = “”
LOGO = “images/logos/windows8.png”
MEMORY = “4096”
MEMORY_UNIT_COST = “MB”
NIC = [
NETWORK = “VNetwork-KVM-5.9.100.236”,
NETWORK_UNAME = “oneadmin”,
SECURITY_GROUPS = “0” ]
NIC_DEFAULT = [
MODEL = “virtio” ]
OS = [
BOOT = “disk0” ]
VCPU = “4”

I was able to get Windows server 2019 to work, were you able to run this step from the docs? My ONE system is down right now while I’m doing some upgrades, I can check what was on the virtio driver CD when it’s back up.

Are you able to tell if the NIC virtio drivers are loaded?

Windows

Download the MSI package into C:\ :

Or execute this command in powershell:

(New-Object Net.WebClient).DownloadFile(“https://github.com/OpenNebula/addon-context-windows/releases/download/v6.0.0/one-context-6.0.0.msi”, “C:\one-context-6.0.0.msi”)

@christaylor . I am able to create a VM for Windows Server 2019 . But the NIC is different , and the IP are also different from my KVM node NIC i.e It is giving me the default NIC of Realteak.
So, how can we change the NIC and keep same as of the NIC of the node?
What should we use for “Default hardware model to emulate for all NICs” in the interface execpt for virtio? As my sever NIC is of Intel and I have created a bridge connection for public IP.

If I understand you correctly, It looks like you have in your template is correct, where you say

NIC_DEFAULT=[
  MODEL="virtio" ]

That’s what you want- the virtualized NIC (not the same as on your bare metal KVM server).

As for the VM IP, it will pull a free address from the range in the vnet assigned when you instantiated.

What does onevm show <vm ID> say under the section “VM NICS”. One of my running VMs says

VM NICS
 ID NETWORK              BRIDGE       IP              MAC               PCI_ID
  0 cloudvnet15          onebr15      10.xxx.xxx.xxx    02:00:0a:7b:

Because I attached a NIC from the cloudvnet15 vnet. OpenNebula sets up the bridge for me automatically.

1 Like

@christaylor So, why the NIC is assigning the different IP . I can see there is one context.sh file generated in of the Context Drive. There is the information for the interface i.e public, private IP. But the NIC is showing different IP.
The Created VM template has the correct IP .

NIC = [
AR_ID = “0”,
BRIDGE = “br0”,
BRIDGE_TYPE = “linux”,
CLUSTER_ID = “0”,
INBOUND_AVG_BW = “1000”,
INBOUND_PEAK_BW = “1000”,
INBOUND_PEAK_KB = “1000”,
IP = “148.251.146.XX”,
MAC = “02:00:94:fb:92:XX”,
NAME = “NIC0”,

But the VM NIC is assigning the IP of 169.254.222.56 which is not my NIC IP.

onvm show
VM NICS
ID NETWORK BRIDGE IP MAC PCI_ID
0 VNetwork-KVM-5.9.xx br0 148.251.146.xx 02:00:94:fb:92:53
1 NEW-VN-PRIVATE prv0 10.10.15.2 02:00:0a:0a:0f:02

@christaylor I have created a new template using the new one-context provided by you. Still it is showing different IP.

Hmm, something is strange with the configuration. An IP of 169.254.222.56 is a local address a host gets when it can’t get talk to a DHCP server, or something like that.

Maybe you could check the output of the contextualization script on your Windows VM? I think it saves it in c:\one-context or some path like that- sorry, I can’t look on a VM right now. Anyway it has all the output from the context Powershell when the VM starts.Maybe there’s some clue.

Maybe you could try a very simple template with only one public IP on one NIC?

1 Like

@christaylor There is output file of contextualization script in one of the directory. This file has got all the correct information regarding public IP , gateway and netmask. But this file is not being implement inside the VM and NIC is assigning 169.254.222.56 IP.

Yes, I have tried with the single NIC as well , still same issue.

I’m not sure why it’s not working for you- I’d say, just keep working with it. That IP you’re getting is like a failed DHCP request or something - I’m not sure.

On one of my templates, after the VM boots I see this part in .onecontext\opennebula-context.log:

Configuring Network Settings: Red Hat VirtIO Ethernet Adapter
- Release DHCP Lease
  ... Failed: 83
- Set Static IP
  ... Success
- Set Gateway
  ... Success
- Set DNS Server Search Order
  ... Success
- Set Dynamic DNS Registration
  ... Success
- Ping Interface IP 172.16.100.2
  ... Success (1 tries)

Then I get this when I run ipconfig:

Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : Red Hat VirtIO Ethernet Adapter
   Physical Address. . . . . . . . . : 02-00-AC-10-64-02
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   IPv4 Address. . . . . . . . . . . : 172.16.100.2(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 172.16.100.1
   DNS Servers . . . . . . . . . . . : 172.16.100.1
   NetBIOS over Tcpip. . . . . . . . : Enabled

Do you see any errors in .onecontext\opennebula-context.log ?

Hi, @christaylor it is working now . I have change the context ios by lates one. Releases · OpenNebula/addon-context-windows · GitHub
But I have to run win virtio exec file manually after login into the VM. After that only the NIC is visible. And it was assigning 169.254.xx.xx range IP. After that I reboot the VM and it start working.
This win virtio exec should be run automatically and also the context script right?O r do we have to do this manually every time we create a Windows server and reboot every time?

No, if the virtio NIC drivers are installed in the image and the contextualization script runs you shouldn’t have to do anything every time the VM boots- the virtio NIC should get set up for connectivity and assigned an IP.

When you created the image the first time and booted Windows, were you able to successfully run the step where it asks to install additional drivers from the virtio CD image? Something like about half way through this video:

““OpenNebula - How to Build a Windows Image - YouTube””

There’s a link to that video and some other helpful things in this link- maybe you already know about this guide:

1 Like

Thank you. Yes. I have checked this video and have deployed in the same way . Still the issue exist . I will check this once more.

When your Windows VM boots do you see something like this in the Device Manager? If you click on the “Events” tab in that properties popup do you see any errors or anything unusual?

1 Like

Hi @christaylor , Soory for late reply. There is no issue till now on device manager while reboot.

I’ve really never run into an error like that before- the only thing I can think of is to start a new template and VM creation and make sure you have the very latest version of the Redhat virtio drivers. It seems like something failed during the driver installation process and it’s only half working. I’m not sure if this helps, but I recall during the template and installation process, when the extra drivers virtual CD is mounted, I installed pretty much everything! Sorry I can’t be more specific, but it’s been a while.

Hi, I have used a latest context and virtio driver. You can try with the latest one.

(one-context-6.0.0.iso)

(virtio-win-0.1.185.iso)

@nibatandukar I have same issue. Have you fixed?
IPV4 from gateway and ethernet is different
image