Cant give Windows Virtual Machine a static ip

I’ve been trying to give my virtual machine a static ip so I can remote into it via a SSH tunnel so I can setup Windows on it. I’ve tried using

lxc config device set Windows10LTSC eth0 ipv4.address 10.128.182.4

but that doesn’t do anything to it. Here is my profile that it’s using. Also I’m running LXD version 4.11 on Ubuntu Server 20.04 LTS

config: {}
description: “”
devices:
eth0:
name: eth0
nictype: bridged
parent: lxdbr0
type: nic
root:
path: /
pool: DefaultStorage
type: disk
name: default
used_by:

  • /1.0/instances/GameServer
  • /1.0/instances/WebServer
  • /1.0/instances/extDB3Build
  • /1.0/instances/Windows10LTSC

What does lxc config show --expanded Windows10LTSC show you?

Note that this relies on the DHCP client using a MAC address as main identifier, if it’s using something else, then dnsmasq will not be able to match the static address to the client. Maybe there’s some way to configure your VM to this DHCP behavior.

Here’s the output for that command.

architecture: x86_64
config:
security.secureboot: “false”
volatile.eth0.host_name: tapfff76153
volatile.eth0.hwaddr: 00:16:3e:af:9e:61
volatile.last_state.power: RUNNING
volatile.uuid: e9da8be0-6291-4dad-8031-375736f5d4db
devices:
eth0:
name: eth0
nictype: bridged
parent: lxdbr0
type: nic
iso:
boot.priority: “10”
source: /home/maihym/LXDWindows10.iso
type: disk
root:
path: /
pool: DefaultStorage
size: 50GB
type: disk
ephemeral: false
profiles:

  • default
    stateful: false
    description: “”

I mainly need an IP set because my server doesnt have a GUI and I’m not trying to set one up if I don’t have to so I’m trying to remote in through a SSH tunnel but cant since there’s no IP to connect to.

Ok, that server is configured to boot from an ISO, the Windows installation environment doesn’t have networking support so configuring an IP won’t do you much good.

What you probably should do is run:

  • lxc config set core.https_address :8443
  • lxc config set core.trust_password some-password

And then on your client system (this assumes Ubuntu but this can be made to work with other Linux distros as well as Windows and macOS), you’d do:

  • apt install virt-viewer
  • snap install lxd
  • lxc remote add my-server https://IP:8443
  • lxc remote switch my-server
  • lxc list
  • lxc start Windows10LTSC --console=vga

This will make your desktop system talk to LXD on your server and using the LXD API will let you access the interactive graphical console so you can perform your installation and initial configuration.

So how could I go about doing this with a windows client? I have the virt-viewer client on Windows but cant access the VM unless I somehow connect to it which is why I tried using a SSH tunnel.

  • choco install virt-viewer
  • choco install lxd
  • lxc remote add my-server https://IP:8443
  • lxc remote switch my-server
  • lxc list
  • lxc start Windows10LTSC --console=vga

That’s assuming you can get chocolatey on your system, if not, considering you already have virt-viewer installed, just getting the LXD binary client for Windows from Github may be sufficient (it may depend on whether LXD manages to locate your current virt viewer install though).

https://github.com/lxc/lxd/suites/2063036528/artifacts/41657993 is the direct link to a recent Windows build, note that you need to login to Github to access that apparently…

If using Chocolatey isn’t an issue for you, I’d recommend using that to install both LXD and virt-viewer as that’s what we normally test with.

Thank you I can finally see the Windows installation process. Once I install windows should I delete the ISO device and delete the iso? BTW I used choco and that worked perfectly.

Yep, you can remove the device. Maybe keep the ISO around in case you need to install again, but otherwise it can indeed go away.

Awesome thanks, btw I found a version of LTSC that I was able to convert for LXD.
https://www.microsoft.com/en-us/evalcenter/evaluate-windows-10-enterprise

Is there a way for me to change the resolution to 1080p instead of 800x600? Also the VM feels kinda slow, is there a way to increase how many cores it has or something?

You should set limits.cpu to the number of cores you want and limits.memory to at least 4GiB for a reasonable Windows experience.

For VGA, there currently aren’t native Windows drivers for virtio-vga, so you’re stuck with basic VGA. Usually I just do the install through the low res output and then switch to RDP for a proper desktop experience.

Ahh right forgot about just RDPing in thanks

I’m trying to convert Windows Server 2016 but distrobuilder can’t seem to get the version. It’s outputting

Error: Failed to detect Windows version. Please provide the version using the --version flag

Any thoughts on this @monstermunchkin? Thanks

Distrobuilder doesn’t support Windows Server 2016. TBH we only considered Windows Server 2012 and Windows Server 2019. Anyway, I’ll fix that as there is no reason to exclude Windows Server 2016.

1 Like

Awesome thank you, please let me know when to try again and I’ll try it.

Once https://github.com/lxc/distrobuilder/pull/393 is merged, and the distrobuilder snap (channel=latest/edge) is updated, you can try again. Shouldn’t take too long.